This afternoon we saw that the Azure Rest API has a new version which is causing our Azure PowerShell (5.3.0) requests to fail. The endpoint being called is the 2018-10-01 which returns 400 Bad Request:
{"error": {"code": "PatchResourceReadFailed","message": "The request to GET resource 'https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/infrbaz1_rg/providers/Microsoft.Compute/virtualMachines/infrbaz1ln01?api-version=2018-10-01' for patching failed with status 'BadRequest'." } }
When we change the endpoint in Postman to 2017-12-01 the request completes ok.
Steps to Repro:
AzureRm Version 5.3.0
AzureRm.Resources Version 5.3.0
$vmName = ""
$myVM = Get-AzureRmResource | Where-Object{$_.resourceName -ieq $vmName }
$myVM.Tags.Add("Test","TestTag")
$myVM | Set-AzureRmResource -Force
It looks as thought Azure Powershell always uses the latest available endpoints and the latest (2018-10-01) doesn't seem compatible with the models Powershell is providing