Hi
Kindly review your subscription ID in your azure portal .
Also refer this : https://www.youtube.com/watch?v=wJqdXjpKQII
------------If you find this helpful , Please accept the answer --------------
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Not able to cannot create VM using PowerShell commands. Getting an error:
ERROR: New-AzVM : Subscription db9d3b30-6d46-4e22-9170-87b069eeaf08 was not found.
230603-image.png
Below are the required details and script commands used to create the VM:
Subscription: db9d3b30-6d46-4e22-9170-87b069eeaf08 [PROD-SUB]
Region: East US 2
Commands used to create the Windows VM in PowerShell:
$PIP = New-AzPublicIpAddress -Name windows-jumpbox-pip -Location eastus2 -AllocationMethod Dynamic -ResourceGroupName mgmt-nodes-eastus2
$NIC = New-AzNetworkInterface -Name windows-jumpbox-nic -ResourceGroupName mgmt-nodes-eastus2 -Location eastus2 -SubnetId "/subscriptions/db9d3b30-6d46-4e22-9170-87b069eeaf08/resourceGroups/mgmt-nodes-eastus2/providers/Microsoft.Network/virtualNetworks/idrac-nodes-eastus2/subnets/idrac-vm-subnet" -PublicIpAddressId $PIP.Id
$securePassword = ConvertTo-SecureString '***************' -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ("azureuser", $securePassword);
$VirtualMachine = New-AzVMConfig -VMName windows-jumpbox -VMSize Standard_D2s_v3
$VirtualMachine = Set-AzVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName "windows-jumpbox" -Credential $Credential -ProvisionVMAgent True
$VirtualMachine = Set-AzVMSourceImage -VM $VirtualMachine -PublisherName 'MicrosoftWindowsDesktop' -Offer "Windows-10" -Sku "win10-21h2-ent-g2" -Version "latest"
$VirtualMachine = Add-AzVMNetworkInterface -VM $VirtualMachine -Id $NIC.Id
New-AzVM -ResourceGroupName "mgmt-nodes-eastus2" -Location eastus2 -VM $VirtualMachine
Hi
Kindly review your subscription ID in your azure portal .
Also refer this : https://www.youtube.com/watch?v=wJqdXjpKQII
------------If you find this helpful , Please accept the answer --------------
Hello @alex ,
Thanks for reaching out.
Please check which subscription you have access to by using the below command.
Get-AzSubscription
The, using the below command, set your active subscription for this session using the below command.
Set-AzContext -SubscriptionId "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
Hope this helps. Feel free to revert back if you have any questions,
-----------------
If you find the above information helpful, kindly accept as answer
or upvote
to increase the relevancy of this post.