问题
azure vm list and azure location list command shows different capitalization for location for some regions such as CanadaEast (might also happen in other locations)
Steps to reproduce:
Deploy a vm in Canada East Run azure vm list run azure location lists ... When you compare outputs you get different capitalization for CanadaEast but other older regions such as North Europe are always in lowercase
$ azure location list data: data: Location : **canadaeast** data: DisplayName : Canada East data: Providers : Microsoft.ApiManagement, Microsoft.Batch, Microsoft.ClassicCompute, Microsoft.ClassicNetwork...
`
10:55 $ azure vm list
info: Executing command vm list
+ Getting virtual machines
data: ResourceGroupName Name ProvisioningState PowerState Location Size
data: ----------------- --------------- ----------------- ---------- ----------- -----------
data: RG2FAILIMPORT importmustfail Succeeded VM running northeurope Standard_A1
data: ABIQUO-CANADAEAST abq-8e2f880d-7f Succeeded VM running **CanadaEast** Basic_A0
data: ABIQUO-CANADAEAST abq-db821ef0-b5 Succeeded VM running **CanadaEast** Basic_A0
info: vm list command OK
`
This behavior is inconsistent and causes issues with 3rd party tools when comparing or accessing resources in these regions. It's not limited to VirtualMachines and also happens with Images and other resources
回答1:
Gleb is spot on - ARM is not case sensitive, so your code should not be either.
回答2:
Microsoft finally fixed this inconsistency and all locations are returned in lowercase now so the issue no longer exists.
However it's still true all code using this API should be case insensitive to avoid problems.
来源:https://stackoverflow.com/questions/50068324/azure-arm-api-returns-locations-with-inconsistent-case