How to solve this subscription spending limit issue

Alice Hong 15 Reputation points
2023-06-14T13:39:17.69+00:00

I tried creating a VM and then got this error message about my Azure Subscription. ( attached in the photo) Note that I'm a new user and just signed up on 4th June and everything was working fine till yesterday. I still have about 199usd free credits which I use for my learning. I'm on a free trial which is scheduled to expire in 19 days. I'm learning an Azure course on udemy and I really need to utilise it.2023-06-13_23-31-56-b3989d9fd9f48faf31f2d316052c65f5

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,082 questions
{count} votes

6 answers

Sort by: Most helpful
  1. Vien LE THI KIM 1 Reputation point
    2024-10-29T04:09:38.8066667+00:00

    I got the same issue today and tried with command lines, then it worked

    param (
        [string]$ResourceGroup = "YourResourceGroupName",
        [string]$VmName = "YourVmName",
        [string]$VnetName = "YourVnetName",
        [string]$SubnetName = "YourSubnetName",
        [string]$Location = "southeastasia",
        [string]$AdminUsername = "YourAdminUsername",
        [string]$AdminPassword = "YourPassword123!",
        [string]$AddressPrefix = "10.0.0.0/16",
        [string]$SubnetPrefix = "10.0.0.0/24",
        [string]$PublisherName = "MicrosoftWindowsDesktop",
        [string]$Offer = "windows-11",
        [string]$Skus = "win11-24h2-pro",
        [string]$Version = "latest",
        [string]$VmSize = "Standard_B2s"
    )
    
    # Create a virtual network
    New-AzVirtualNetwork -ResourceGroupName $ResourceGroup -Location $Location -Name $VnetName -AddressPrefix $AddressPrefix -Subnet @{"Name" = $SubnetName; "AddressPrefix" = $SubnetPrefix}
    
    # Create a public IP address with Static allocation and DNS name
    $PublicIp = New-AzPublicIpAddress -ResourceGroupName $ResourceGroup -Location $Location -Name "${VmName}PublicIP" -AllocationMethod Static -Sku Standard -DnsName $VmName
    
    # Create a network security group
    $Nsg = New-AzNetworkSecurityGroup -ResourceGroupName $ResourceGroup -Location $Location -Name "${VmName}NSG"
    
    # Create a network security group rule to allow RDP
    $NsgRule = New-AzNetworkSecurityRuleConfig -Name "AllowRDP" -Protocol "Tcp" -Direction "Inbound" -Priority 1000 -SourceAddressPrefix "*" -SourcePortRange "*" -DestinationAddressPrefix "*" -DestinationPortRange 3389 -Access "Allow"
    $Nsg.SecurityRules.Add($NsgRule)
    $Nsg | Set-AzNetworkSecurityGroup
    
    # Create a virtual network interface and associate with public IP address and NSG
    $Nic = New-AzNetworkInterface -ResourceGroupName $ResourceGroup -Location $Location -Name "${VmName}NIC" -SubnetId (Get-AzVirtualNetwork -ResourceGroupName $ResourceGroup -Name $VnetName).Subnets[0].Id -PublicIpAddressId $PublicIp.Id -NetworkSecurityGroupId $Nsg.Id
    
    # Create a virtual machine without boot diagnostics
    $VmConfig = New-AzVMConfig -VMName $VmName -VMSize $VmSize | `
        Set-AzVMOperatingSystem -Windows -ComputerName $VmName -Credential (New-Object PSCredential -ArgumentList $AdminUsername, (ConvertTo-SecureString -String $AdminPassword -AsPlainText -Force)) | `
        Set-AzVMSourceImage -PublisherName $PublisherName -Offer $Offer -Skus $Skus -Version $Version | `
        Add-AzVMNetworkInterface -Id $Nic.Id | `
        Set-AzVMOSDisk -CreateOption FromImage -ManagedDiskId $null -StorageAccountType "Standard_LRS" | `
        Set-AzVMBootDiagnostics -Disable
    
    New-AzVM -ResourceGroupName $ResourceGroup -Location $Location -VM $VmConfig
    
    # Open port 3389 to allow RDP traffic
    Get-AzNetworkSecurityGroup -ResourceGroupName $ResourceGroup -Name "${VmName}NSG" | Add-AzNetworkSecurityRuleConfig -Name "AllowRDP" -Protocol "Tcp" -Direction "Inbound" -Priority 1000 -SourceAddressPrefix "*" -SourcePortRange "*" -DestinationAddressPrefix "*" -DestinationPortRange 3389 -Access "Allow" | Set-AzNetworkSecurityGroup
    
    
    
    0 comments No comments

Your answer

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