Hope doing good!, Thanks for reaching out to us
Please try below three methods and let us know the results and also please accept it helps you solving your issue
1 .Try Using a Different Azure PowerShell Module Version: If updating to the latest version didn't resolve the issue, you can try using an older version of the Azure PowerShell module. Uninstall the current version, and then install a specific version using the following commands:
Uninstall-Module -Name Az
Install-Module -Name Az -RequiredVersion <Version>
- Try Using Azure CLI: If you are still facing issues with PowerShell, you can try using Azure CLI to see if you encounter the same problem. The Azure CLI uses a different set of libraries and might provide different results:
bashCopy code
az vm show --resource-group <ResourceGroupName> --name <VMName> --output json
3. Verify Resource Provider Registration: Sometimes, resource providers might have issues or be unregistered. Verify that the 'Microsoft.Compute' resource provider is registered for your subscription. You can use the following PowerShell command to check and, if necessary, register it:
Register-AzResourceProvider -ProviderNamespace Microsoft.Compute