Error during VM creation in Azure CLI

Roshan Thomas 25 Reputation points
2025-09-11T22:16:26.43+00:00

I gave the following command in Azure CLI, as instructed in a Azure course at the link: https://learn.microsoft.com/en-us/training/modules/describe-azure-compute-networking-services/3-exercise-create-azure-virtual-machine


az vm create --resource-group "IntroAzureRG" --name my-vm --size Standard_D2s_v5 --public-ip-sku Standard --image Ubuntu2204 --admin-username azureuser --generate-ssh-keys


and get the following errors below. Please help.


The command failed with an unexpected error. Here is the traceback:

The content for this response was already consumed

Traceback (most recent call last):

File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job

result = cmd_copy(params)

         ^^^^^^^^^^^^^^^^

File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 336, in call

return self.handler(*args, **kwargs)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler

return op(**command_args)

       ^^^^^^^^^^^^^^^^^^

File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/command_modules/vm/custom.py", line 1171, in create_vm

LongRunningOperation(cmd.cli_ctx)(client.begin_create_or_update(resource_group_name, deployment_name, deployment))

                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib64/az/lib/python3.12/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer

return func(*args, **kwargs)

       ^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib64/az/lib/python3.12/site-packages/azure/mgmt/resource/resources/v2024_11_01/operations/_operations.py", line 7094, in begin_create_or_update

raw_result = self._create_or_update_initial(

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib64/az/lib/python3.12/site-packages/azure/mgmt/resource/resources/v2024_11_01/operations/_operations.py", line 6987, in _create_or_update_initial

raise HttpResponseError(response=response, error_format=ARMErrorFormat)

azure.core.exceptions.HttpResponseError: (InvalidTemplateDeployment) The template deployment 'vm_deploy_C6OWmqGICBOZ1rR34BajweiGj1OCEoQj' is not valid according to the validation procedure. The tracking id is 'ac9e3093-7bde-424b-8df2-648a7da0fb3e'. See inner errors for details.

Code: InvalidTemplateDeployment

Message: The template deployment 'vm_deploy_C6OWmqGICBOZ1rR34BajweiGj1OCEoQj' is not valid according to the validation procedure. The tracking id is 'ac9e3093-7bde-424b-8df2-648a7da0fb3e'. See inner errors for details.

Exception Details: (SkuNotAvailable) The requested VM size for resource 'Following SKUs have failed for Capacity Restrictions: Standard_D2s_v5' is currently not available in location 'eastus'. Please try another size or deploy to a different location or different zone. See https://aka.ms/azureskunotavailable for details.

    Code: SkuNotAvailable

    Message: The requested VM size for resource 'Following SKUs have failed for Capacity Restrictions: Standard_D2s_v5' is currently not available in location 'eastus'. Please try another size or deploy to a different location or different zone. See https://aka.ms/azureskunotavailable for details.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/lib64/az/lib/python3.12/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 "/usr/lib64/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke

cmd_result = self.invocation.execute(args)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 666, in execute

raise ex

File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 734, in _run_jobs_serially

results.append(self._run_job(expanded_arg, cmd_copy))

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 726, in _run_job

return cmd_copy.exception_handler(ex)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib64/az/lib/python3.12/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 "/usr/lib64/az/lib/python3.12/site-packages/requests/models.py", line 926, in text

if not self.content:

       ^^^^^^^^^^^^

File "/usr/lib64/az/lib/python3.12/site-packages/requests/models.py", line 897, in content

raise RuntimeError("The content for this response was already consumed")

RuntimeError: The content for this response was already consumed

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Ankit Yadav 6,345 Reputation points Microsoft External Staff Moderator
    2025-09-11T22:32:16.93+00:00

    Hello Roshan Thomas,

    Thank you for sharing the detailed failure.

    Your VM creation failed with the error:

    Exception Details: (SkuNotAvailable) The requested VM size for resource 'Following SKUs have failed for Capacity Restrictions: Standard_D2s_v5' is currently not available in location 'eastus'. Please try another size or deploy to a different location or different zone. See https://aka.ms/azureskunotavailable for details.

    This error message as the VM size (Standard_D2s_v5) you are trying to deploy is not available in the region. For more details, please see: https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-sku-not-available?tabs=azure-cli#symptom

    To see what VM sizes are available in the region, you can try the az vm list-skus command to see what D series VMs are available for you.
    Sample command:

    az vm list-skus --location eastus --size Standard_D --all --output table
    

    here:

    • --location filters output by location.
    • --size searches by a partial size name.
    • --all shows all information and includes sizes that aren't available for the current subscription

    Or

    if you are just trying to test out the VM creation using CLI for learning purposes you could use B-series small VM. For example Standard_B1s as it's generally available across all the regions.

    To create Standard_B1s VM, you can alter your command as :

    az vm create --resource-group "IntroAzureRG" --name my-vm --size Standard_B1s --public-ip-sku Standard --image Ubuntu2204 --admin-username azureuser --generate-ssh-keys
    

    If your query has been resolved, please take a moment to accept answers and upvote it 👍 to make it helpful to the community and if there are any questions, do let me know and I'll be happy to assist you further.

    Thank you for helping to improve Microsoft Q&A!

    User's image

    6 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.