New-AzVm fails with 'The subscription is not authorized' error
I have the following command:
New-AzVm -ResourceGroupName 'vs2022rg'
-Name 'vs2022vm'
-Location 'swedencentral'
-Image 'MicrosoftVisualStudio:visualstudio2022:vs-2022-comm-latest-win11-n-gen2:2024.04.15'
-VirtualNetworkName 'vs2022vnet'
-SubnetName 'vs2022subnet'
-SecurityGroupName 'vs2022sg'
-PublicIpAddressName 'vs2022pip'
-OpenPorts 80,3389
When I run it, I get 'New-AzVm : The subscription is not authorized.' error:
I am pretty sure the image URN is correct, as I put it together by querying each of its components. That is, I did not copy/paste a random URN.
I also made sure that the image does not have a purchase plan:
> az vm image terms show --urn 'MicrosoftVisualStudio:visualstudio2022:vs-2022-comm-latest-win11-n-gen2:2024.04.15'
Image 'MicrosoftVisualStudio:visualstudio2022:vs-2022-comm-latest-win11-n-gen2:2024.04.15' has no terms to accept.
I am able to successfully create VMs from my own custom images that reside in my resource groups, so I don't think there's any problem with my subscription.
Note: I have had problems deploying Visual Studio images from the portal as well, so I can't export a successfully deployed VM from the portal to look into its template and see how it's been created.