Search code examples
azurepowershellazure-powershell

How to create a VM using Azure Powershell


I am doing a Udemy course to prepare to take the AZ-104 certification exam. In the course, the tutor is giving a Powershell demonstration and in this demonstration he has created a VM using simple command.

I've tried doing the same thing but I keep getting the following error:

The requested VM size for resource 'Following SKUs have failed for Capacity Restrictions: Standard_B2ats_v2' is currently not available in location 'eastus'. Please try another size or deploy to a different location or different zone

I have printed out a list of VMs available in East US and then I made sure the number of cores was at or below 4. I also looked online to see what VM sizes in particular are available for the free trial. I believe there's a limit of 4 on the number of cores I can deploy. I have an AWS background and so assumed the location of East US would have the most free services for me to deploy and play around with.

Looking in my resource group, which I created first I can see the Security Group, Public IP Address, Network Interface and Virtual Network have been created but not the VM.

I am using Powershell ISE and the command I'm trying to run is:

New-AzVm
-ResourceGroupName 'myResourceGroup' -Name 'myVM' -Location 'eastus' -Image 'MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition:latest' ` -Size Standard_B2ats_v2 -VirtualNetworkName 'myVNet' -SubnetName 'mySubnet' -SecurityGroupName 'myNetworkSecurityGroup' -PublicIpAddressName 'myPublicIpAddress' -OpenPorts 80, 3389

I'm at a loss as to why this isn't working and I've been trying to use Azure Powershell for a couple of days now so I'm not using the online portal as much. Any help would be appreciated.


Solution

  • The relevant part of the error message is "failed for Capacity Restrictions"

    So there is a problem with capacity in Azure East US.

    Try placing the VM in a different region, or try a different SKU.