"az vmss create" for FLEX does not convert "--edge-zone" to "extendedLocation" in template
See original GitHub issue
az feedback
auto-generates most of the information requested below, as of CLI version 2.0.62
Describe the bug
While creating a VMSS (flexible orchestration) in edgeZone, CLI fails to convert “EdgeZone” to “ExtendedLocation” correctly which results in ARM template validation failure. _
{“error”:{“code”:“InvalidTemplate”,“message”:“Deployment template parse failed: ‘Error converting value "microsoftrrdclab1" to type ‘Azure.Deployments.Core.Definitions.Resources.ResourceExtendedLocation’. Path ‘’.’.”}}
_
To Reproduce
az vmss create -n flex1 -g viananth-testflex --image UbuntuLTS --instance-count 2 --orchestration-mode flexible --edge-zone microsoftrrdclab1 --generate-ssh-keys --debug
Expected behavior
Expected to successfully convert “EdgeZone” to the expected “ExtendedLocation” format that ARM understands.
Environment summary
Cloud shell vishnu@Azure:~$ az -v azure-cli 2.34.1
core 2.34.1 telemetry 1.0.6
Extensions: ai-examples 0.2.5 ssh 1.0.0
Dependencies: msal 1.16.0 azure-mgmt-resource 20.0.0
Additional context
vishnu@Azure:~$ az vmss create -n flex1 -g viananth-testflex --image UbuntuLTS --instance-count 2 --orchestration-mode flexible --edge-zone microsoftrrdclab1 --generate-ssh-keys --debug
cli.azure.cli.command_modules.vm._validators: SSH key files ‘/home/vishnu/.ssh/id_rsa’ and ‘/home/vishnu/.ssh/id_rsa.pub’ have been generated under ~/.ssh to allow SSH access to the VM. If using machines without permanent storage, back up your keys to a safe location. cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient urllib3.connectionpool: Starting new HTTP connection (1): localhost:50342 urllib3.connectionpool: http://localhost:50342 “POST /oauth2/token HTTP/1.1” 200 2357 msrestazure.azure_active_directory: MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {‘resource’: ‘https://management.core.windows.net/’} cli.azure.cli.core.auth.adal_authentication: MSIAuthenticationWrapper.get_token invoked by Track 2 SDK with scopes=(‘https://management.core.windows.net//.default’,) urllib3.connectionpool: Starting new HTTP connection (1): localhost:50342 urllib3.connectionpool: http://localhost:50342 “POST /oauth2/token HTTP/1.1” 200 2357 msrestazure.azure_active_directory: MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {‘resource’: ‘https://management.core.windows.net/’} cli.azure.cli.core.auth.adal_authentication: Normalize expires_on: ‘1648149032’ -> 1648149032 cli.azure.cli.core.sdk.policies: Request URL: ‘https://management.azure.com/subscriptions/ffc37441-49e9-4291-a520-0b2d4972bb99/resourcegroups/viananth-testflex/providers/Microsoft.Resources/deployments/vmss_deploy_cWnVuKGafwmidDGfzkOvP95MLdAmcWvR?api-version=2021-04-01’ cli.azure.cli.core.sdk.policies: Request method: ‘PUT’ cli.azure.cli.core.sdk.policies: Request headers: cli.azure.cli.core.sdk.policies: ‘Content-Type’: ‘application/json’ cli.azure.cli.core.sdk.policies: ‘Accept’: ‘application/json’ cli.azure.cli.core.sdk.policies: ‘Content-Length’: ‘4723’ cli.azure.cli.core.sdk.policies: ‘x-ms-client-request-id’: ‘c6718352-ab9e-11ec-8d49-0a580af41049’ cli.azure.cli.core.sdk.policies: ‘CommandName’: ‘vmss create’ cli.azure.cli.core.sdk.policies: ‘ParameterSetName’: ‘-n -g --image --instance-count --orchestration-mode --edge-zone --generate-ssh-keys --debug’ cli.azure.cli.core.sdk.policies: ‘User-Agent’: ‘AZURECLI/2.34.1 (DEB) azsdk-python-azure-mgmt-resource/20.0.0 Python/3.8.12 (Linux-5.4.0-1073-azure-x86_64-with-glibc2.28) cloud-shell/1.0’ cli.azure.cli.core.sdk.policies: ‘Authorization’: ‘*****’ cli.azure.cli.core.sdk.policies: Request body: cli.azure.cli.core.sdk.policies: {“properties”: {“template”: {“$schema”: “https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#”, “contentVersion”: “1.0.0.0”, “parameters”: {}, “variables”: {}, “resources”: [{“name”: “flex1VNET”, “type”: “Microsoft.Network/virtualNetworks”, “location”: “eastus2euap”, “apiVersion”: “2021-02-01”, “dependsOn”: [], “tags”: {}, “properties”: {“addressSpace”: {“addressPrefixes”: [“10.0.0.0/16”]}, “subnets”: [{“name”: “flex1Subnet”, “properties”: {“addressPrefix”: “10.0.0.0/24”}}]}, “extendedLocation”: “microsoftrrdclab1”}, {“apiVersion”: “2021-02-01”, “type”: “Microsoft.Network/publicIPAddresses”, “name”: “flex1LBPublicIP”, “location”: “eastus2euap”, “tags”: {}, “dependsOn”: [], “properties”: {“publicIPAllocationMethod”: “Static”}, “sku”: {“name”: “Standard”}, “extendedLocation”: “microsoftrrdclab1”}, {“type”: “Microsoft.Network/loadBalancers”, “name”: “flex1LB”, “location”: “eastus2euap”, “tags”: {}, “apiVersion”: “2021-02-01”, “dependsOn”: [“Microsoft.Network/virtualNetworks/flex1VNET”, “Microsoft.Network/publicIpAddresses/flex1LBPublicIP”], “properties”: {“backendAddressPools”: [{“name”: “flex1LBBEPool”}], “frontendIPConfigurations”: [{“name”: “loadBalancerFrontEnd”, “properties”: {“publicIPAddress”: {“id”: “/subscriptions/ffc37441-49e9-4291-a520-0b2d4972bb99/resourceGroups/viananth-testflex/providers/Microsoft.Network/publicIPAddresses/flex1LBPublicIP”}}}], “loadBalancingRules”: [{“name”: “LBRule”, “properties”: {“frontendIPConfiguration”: {“id”: “[concat(resourceId(‘Microsoft.Network/loadBalancers’, ‘flex1LB’), ‘/frontendIPConfigurations/’, ‘loadBalancerFrontEnd’)]”}, “backendAddressPool”: {“id”: “[concat(resourceId(‘Microsoft.Network/loadBalancers’, ‘flex1LB’), ‘/backendAddressPools/’, ‘flex1LBBEPool’)]”}, “protocol”: “tcp”, “frontendPort”: 80, “backendPort”: 80, “enableFloatingIP”: false, “idleTimeoutInMinutes”: 5}}]}, “sku”: {“name”: “Standard”}, “extendedLocation”: “microsoftrrdclab1”}, {“type”: “Microsoft.Network/networkSecurityGroups”, “name”: “flex1NSG”, “apiVersion”: “2015-06-15”, “location”: “eastus2euap”, “tags”: {}, “dependsOn”: [], “properties”: {“securityRules”: [{“name”: “default-allow-ssh”, “properties”: {“protocol”: “Tcp”, “sourcePortRange”: “", “destinationPortRange”: “22”, “sourceAddressPrefix”: "”, “destinationAddressPrefix”: “*”, “access”: “Allow”, “priority”: 1000, “direction”: “Inbound”}}]}}, {“type”: “Microsoft.Compute/virtualMachineScaleSets”, “name”: “flex1”, “location”: “eastus2euap”, “tags”: {}, “apiVersion”: “2021-11-01”, “dependsOn”: [“Microsoft.Network/virtualNetworks/flex1VNET”, “Microsoft.Network/loadBalancers/flex1LB”, “Microsoft.Network/networkSecurityGroups/flex1NSG”], “properties”: {“singlePlacementGroup”: false, “platformFaultDomainCount”: 1, “virtualMachineProfile”: {“storageProfile”: {“osDisk”: {“createOption”: “FromImage”, “caching”: “ReadWrite”, “managedDisk”: {“storageAccountType”: null}}, “imageReference”: {“publisher”: “Canonical”, “offer”: “UbuntuServer”, “sku”: “18.04-LTS”, “version”: “latest”}}, “osProfile”: {“computerNamePrefix”: “flex1”, “adminUsername”: “vishnu”, “linuxConfiguration”: {“disablePasswordAuthentication”: true, “ssh”: {“publicKeys”: [{“path”: “/home/vishnu/.ssh/authorized_keys”, “keyData”: “ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAHO/txWPhklFE9FJ32yd/LLyQY8abylJ7opCnw5pMWKhH+1H0U0N9jInoI6TqJd4I9G+IYe561sGkJISS5KsyKIpv2OLqT+ulbLVQhcKqsmWpglrWq/NQGvnLqV+VSih58/55lr4cP/OwzxT81tsTwg8T8g/tNo1t4Yv0JOy3+HJockp0DN0uKa36/KxTSpGMVDfSB69SWG0bSKx9mjSuE86HgSwbkwy4IJd1hX/GuwPij5QJnfEH1yW9fUrfncdlFNPk/LUvr2k0R9m68h72okZMTfz/qK1RkqgeAJlErXZ4V+QlCOF7Z+PQvdvLEL1VkEb4/rqz46i+AtqPqbJp”}]}}}, “networkProfile”: {“networkInterfaceConfigurations”: [{“name”: “flex1b81fNic”, “properties”: {“ipConfigurations”: [{“name”: “flex1b81fIPConfig”, “properties”: {“subnet”: {“id”: “/subscriptions/ffc37441-49e9-4291-a520-0b2d4972bb99/resourceGroups/viananth-testflex/providers/Microsoft.Network/virtualNetworks/flex1VNET/subnets/flex1Subnet”}, “loadBalancerBackendAddressPools”: [{“id”: “/subscriptions/ffc37441-49e9-4291-a520-0b2d4972bb99/resourceGroups/viananth-testflex/providers/Microsoft.Network/loadBalancers/flex1LB/backendAddressPools/flex1LBBEPool”}]}}], “networkSecurityGroup”: {“id”: “[resourceId(‘Microsoft.Network/networkSecurityGroups’, ‘flex1NSG’)]”}, “primary”: “true”}}], “networkApiVersion”: “2020-11-01”}}, “orchestrationMode”: “Flexible”}, “sku”: {“name”: “Standard_DS1_v2”, “capacity”: 2}, “extendedLocation”: “microsoftrrdclab1”}], “outputs”: {“VMSS”: {“type”: “object”, “value”: “[reference(resourceId(‘Microsoft.Compute/virtualMachineScaleSets’, ‘flex1’),providers(‘Microsoft.Compute’, ‘virtualMachineScaleSets’).apiVersions[0])]”}}}, “parameters”: {}, “mode”: “incremental”}} urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443 urllib3.connectionpool: https://management.azure.com:443 “PUT /subscriptions/ffc37441-49e9-4291-a520-0b2d4972bb99/resourcegroups/viananth-testflex/providers/Microsoft.Resources/deployments/vmss_deploy_cWnVuKGafwmidDGfzkOvP95MLdAmcWvR?api-version=2021-04-01 HTTP/1.1” 400 220 cli.azure.cli.core.sdk.policies: Response status: 400 cli.azure.cli.core.sdk.policies: Response headers: cli.azure.cli.core.sdk.policies: ‘Cache-Control’: ‘no-cache’ cli.azure.cli.core.sdk.policies: ‘Pragma’: ‘no-cache’ cli.azure.cli.core.sdk.policies: ‘Content-Type’: ‘application/json; charset=utf-8’ cli.azure.cli.core.sdk.policies: ‘Expires’: ‘-1’ cli.azure.cli.core.sdk.policies: ‘x-ms-failure-cause’: ‘gateway’ cli.azure.cli.core.sdk.policies: ‘x-ms-ratelimit-remaining-subscription-writes’: ‘1199’ cli.azure.cli.core.sdk.policies: ‘x-ms-request-id’: ‘6334c2ba-d3c1-4b35-baaf-4e88d074b02b’ cli.azure.cli.core.sdk.policies: ‘x-ms-correlation-request-id’: ‘6334c2ba-d3c1-4b35-baaf-4e88d074b02b’ cli.azure.cli.core.sdk.policies: ‘x-ms-routing-request-id’: ‘WESTUS:20220324T181824Z:6334c2ba-d3c1-4b35-baaf-4e88d074b02b’ cli.azure.cli.core.sdk.policies: ‘Strict-Transport-Security’: ‘max-age=31536000; includeSubDomains’ cli.azure.cli.core.sdk.policies: ‘X-Content-Type-Options’: ‘nosniff’ cli.azure.cli.core.sdk.policies: ‘Date’: ‘Thu, 24 Mar 2022 18:18:23 GMT’ cli.azure.cli.core.sdk.policies: ‘Content-Length’: ‘220’ cli.azure.cli.core.sdk.policies: Response content: cli.azure.cli.core.sdk.policies: {“error”:{“code”:“InvalidTemplate”,“message”:“Deployment template parse failed: ‘Error converting value "microsoftrrdclab1" to type ‘Azure.Deployments.Core.Definitions.Resources.ResourceExtendedLocation’. Path ‘’.’.”}} cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception: cli.azure.cli.core.util: Traceback (most recent call last): File “/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py”, line 692, in _run_job result = cmd_copy(params) File “/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py”, line 328, in call return self.handler(*args, **kwargs) File “/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py”, line 121, in handler return op(**command_args) File “/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/vm/custom.py”, line 3143, in create_vmss sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, deployment_name, deployment)) File “/opt/az/lib/python3.8/site-packages/azure/cli/core/util.py”, line 678, in sdk_no_wait return func(*args, **kwargs) File “/opt/az/lib/python3.8/site-packages/azure/mgmt/resource/resources/v2021_04_01/operations/_deployments_operations.py”, line 3389, in begin_create_or_update raw_result = self._create_or_update_initial( File “/opt/az/lib/python3.8/site-packages/azure/mgmt/resource/resources/v2021_04_01/operations/_deployments_operations.py”, line 3338, in _create_or_update_initial raise HttpResponseError(response=response, error_format=ARMErrorFormat) azure.core.exceptions.HttpResponseError: (InvalidTemplate) Deployment template parse failed: ‘Error converting value “microsoftrrdclab1” to type ‘Azure.Deployments.Core.Definitions.Resources.ResourceExtendedLocation’. Path ‘’.’. Code: InvalidTemplate Message: Deployment template parse failed: ‘Error converting value “microsoftrrdclab1” to type ‘Azure.Deployments.Core.Definitions.Resources.ResourceExtendedLocation’. Path ‘’.’.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/arm.py”, line 109, in handle_template_based_exception raise CLIError(ex.inner_exception.error.message) AttributeError: ‘NoneType’ object has no attribute ‘error’
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “/opt/az/lib/python3.8/site-packages/knack/cli.py”, line 231, in invoke cmd_result = self.invocation.execute(args) File “/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py”, line 658, in execute raise ex File “/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py”, line 721, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File “/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/init.py”, line 713, in _run_job return cmd_copy.exception_handler(ex) File “/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/arm.py”, line 112, in handle_template_based_exception raise_subdivision_deployment_error(ex.response.internal_response.text, ex.error.code if ex.error else None) File “/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/arm.py”, line 104, in raise_subdivision_deployment_error raise DeploymentError(error_message) azure.cli.core.azclierror.DeploymentError: {“error”:{“code”:“InvalidTemplate”,“message”:“Deployment template parse failed: ‘Error converting value "microsoftrrdclab1" to type ‘Azure.Deployments.Core.Definitions.Resources.ResourceExtendedLocation’. Path ‘’.’.”}}
cli.azure.cli.core.azclierror: {“error”:{“code”:“InvalidTemplate”,“message”:“Deployment template parse failed: ‘Error converting value "microsoftrrdclab1" to type ‘Azure.Deployments.Core.Definitions.Resources.ResourceExtendedLocation’. Path ‘’.’.”}} az_command_data_logger: {“error”:{“code”:“InvalidTemplate”,“message”:“Deployment template parse failed: ‘Error converting value "microsoftrrdclab1" to type ‘Azure.Deployments.Core.Definitions.Resources.ResourceExtendedLocation’. Path ‘’.’.”}} cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f80f1a2b820>] az_command_data_logger: exit code: 1 cli.main: Command ran in 8.294 seconds (init: 0.118, invoke: 8.176) telemetry.save: Save telemetry record of length 3339 in cache telemetry.check: Negative: The /home/vishnu/.azure/telemetry.txt was modified at 2022-03-24 18:15:43.419942, which in less than 600.000000 s
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
@viananth We are looking into it and get back to you for any questions.
I think let’s wait on service support, unless we see this error many more times.
Jerry Steele Microsoft senior program manager 425.421.2566
From: Xing Zhou @.> Sent: Thursday, April 7, 2022 5:36 PM To: Azure/azure-cli @.> Cc: Jerry Steele @.>; Mention @.> Subject: Re: [Azure/azure-cli] “az vmss create” for FLEX does not convert “–edge-zone” to “extendedLocation” in template (Issue #21793)
@fitzgeraldsteelehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffitzgeraldsteele&data=05|01|jerry.steele%40microsoft.com|c52f1ab40bc3412920dc08da18f7d947|72f988bf86f141af91ab2d7cd011db47|1|0|637849750032921775|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=zb55c4zs84vrDK0t7wjnLgkkPXc%2Bq0sYywT4QJcl1n0%3D&reserved=0 Does the error message meet the expectation at present? Should we keep the behavior and wait for service support, or do we need to add verification for not allowing inputting --edge-zone when creating Flex VMSS?
— Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-cli%2Fissues%2F21793%23issuecomment-1092328302&data=05|01|jerry.steele%40microsoft.com|c52f1ab40bc3412920dc08da18f7d947|72f988bf86f141af91ab2d7cd011db47|1|0|637849750032921775|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=%2B7fx08ZCybz9WxtPhsSFQyL8RNENNYSBOuQIYMuyGhQ%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAABGQSB4HBCAWR63KNQA26DVD55RRANCNFSM5RR7CF2Q&data=05|01|jerry.steele%40microsoft.com|c52f1ab40bc3412920dc08da18f7d947|72f988bf86f141af91ab2d7cd011db47|1|0|637849750032921775|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=7iNqs%2FWz%2FKcbFZLLVvABN1UZAV9h76ejzcl8NYj2pEY%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>