Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"az vmss create" for FLEX does not convert "--edge-zone" to "extendedLocation" in template #21793

Closed
viananth opened this issue Mar 24, 2022 · 6 comments · Fixed by #21992
Closed
Assignees
Labels
Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot
Milestone

Comments

@viananth
Copy link
Member

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

@ghost ghost added the Network az network vnet/lb/nic/dns/etc... label Mar 24, 2022
@ghost ghost added this to the Backlog milestone Mar 24, 2022
@ghost ghost assigned kairu-ms Mar 24, 2022
@ghost ghost added Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot labels Mar 24, 2022
@ghost ghost assigned zhoxing-ms Mar 24, 2022
@ghost ghost added the Storage az storage label Mar 24, 2022
@ghost ghost assigned evelyn-ys Mar 24, 2022
@ghost ghost added ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group VM SSH CXP Attention This issue is handled by CXP team. SSH Installation labels Mar 24, 2022
@ghost ghost assigned jiasli Mar 24, 2022
@ghost ghost added the AAD label Mar 24, 2022
@SaurabhSharma-MSFT
Copy link
Member

@viananth We are looking into it and get back to you for any questions.

@yonzhan yonzhan removed Storage az storage Network az network vnet/lb/nic/dns/etc... AAD ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Installation SSH labels Mar 26, 2022
@yonzhan yonzhan removed the VM SSH label Mar 26, 2022
@yonzhan yonzhan removed the CXP Attention This issue is handled by CXP team. label Mar 26, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Mar 26, 2022

Compute

@cxznmhdcxz
Copy link
Member

Hi @fitzgeraldsteele , when validly converted --edge-zone to extendedLocation, and orchestrationMode is Flexible, the reponse is:

{"code":"BadRequest","message":"{ "error": { "code": "InvalidParameter", "message": "Parameter 'extendedLocation' is not allowed.", "target": "extendedLocation" }}}

and when orchestrationMode is Uniform, VMSS is successfully created.
Does flexible VMSS support edge zone?

@fitzgeraldsteele
Copy link

fitzgeraldsteele commented Apr 7, 2022 via email

@zhoxing-ms
Copy link
Contributor

@fitzgeraldsteele 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?

@fitzgeraldsteele
Copy link

fitzgeraldsteele commented Apr 8, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot
Projects
None yet
10 participants