Cannot use Get commands in Azure RM portal using powershell - azure

I am trying to create VM in resource manager portal using powershell.
Get-AzureRmLocation,Get-AzureRmVirtualNetwork,Get-AzureRmAvailabilitySet these commands cannot be used.It shows an error as "The term 'Get-AzureRmLocation' is not recognized as the name of a cmdlet, function". Please let me know how to resolve this. Thanks in advance.

They got rid of this command, despite my desperate attempts to get them to add it back. Use Get-AzureRmResourceProvider to find the supported Azure regions for each Resource Provider.

It seems this Cmdlet has been removed! Please see the detailed discussion here: https://github.com/Azure/azure-powershell/issues/1299.
Based on this, it is recommended to use Get-AzureRmResourceProvider. As a fallback, you can also use Get-AzureLocation but I suspect that it makes use of Service Management module instead of Resource Manager.

Related

Get list of all azure policies assigned to a subscription using powershell

I am new to Azure. I am trying to get the policies assigned to a subscription(1e1707b7-XXXX-XXXX-XXXX-71feab4b911d) using powershell below. I am not getting the correct count of policies applied to that subscription.
Get-AzPolicyAssignment -Scope "/subscriptions/1e1707b7-XXXX-XXXX-XXXX-71feab4b911d"
I think there is some problem with the scope. Can someone help me with this?
That should be the correct command. Do you also include assignments coming from ancestors ? That might be the reason why you expect to see more than what you got from the command. Here it getting assignments from this specific scope only, not then one inherited from the parents (Management Groups).
You can do so using the -IncludeDescendent parameter - see official documentation.

Get extended information on Azure Advisor recommendations via Powershell

I'm trying to use Get-AzAdvisorRecommendation command for automatic sending of emails to users, that appear in Advisor's alerts. Issue being, that Get-AzAdvisorRecommendation command does not show the actual description of the recommendation, like "Right-size or shutdown underutilized virtual machines" in the output. It only gives vague information like "ShortDescription: Microsoft.Azure.Commands.Advisor.Cmdlets.Models.PsRecommendationBaseShortDescription" and RecommendationTypeID.
Azure CLI "az advisor recommendation list" command does provide the information under "shortDescription" value. Is there any way to get the same information using Get-AzAdvisorRecommendation command?
Indeed. ShortDescription is returned in the response as a nested property. You can access it as follows:
Get-AzAdvisorRecommendation | Select-Object RecommendationTypeId, #{Name="ShortDescription"; Expression={$_.ShortDescription.Problem}}
Include (select) other properties as needed.

The template deployment 'Microsoft.Web-WebApp-Portal-3994ede8-a307' is not valid according to the validation procedure

This is part of an exercise of MS Learning, https://learn.microsoft.com/en-us/learn/modules/create-release-pipeline/5-deploy-to-appservice. On manual creation of Azure App Service, I am getting the error.
Please help with the Cause and Resolution
Steps to recreate:
azure.com >> Azure App Service >> +Add > add the project details like subscription, resource group etc... >> Review+Create, Below error:
The template deployment 'Microsoft.Web-WebApp-Portal-3994ede8-a307' is not valid according to the validation procedure. The tracking id is 'ca7e085f-a756-4344-bfe1-07444ff0fe0e'. See inner errors for details.
I'd like to know what is causing this error - and how I can avoid it?
So looking at the output in the network tab of the browser i saw this:
The requested app service plan cannot be created in the current resource group because it is hosting Linux apps. Please choose a different resource group or create a new one.
So deleted the app service plan/web app and now it works.
MS, please show us the error ...
I was able to fix this error by simply recreating webapp, and selecting another location. From Central Usa to South Central USA. It worked for me
Changing the location, helped me in fixing this error.
I was facing the same issue so I changed the location from "East US" to "East US 2" and it also worked for me.

Request timing out when exporting Azure resource group in powershell

I want to export an ARM template for a resource group in Windows Azure. I'm using the Azure Powershell module.
Whenever I try to export the resource group using Export-AzResourceGroup, the cmdlet fails with the following error:
Export-AzResourceGroup : Operation failed because a request timed out.
I have inspected the web traffic with Fiddler and I can see that the actual HTTP call to Azure is completing successfully, it's just taking a long time. So it's not a matter of e.g. extending the timeout on the ServicePointManager.
Is there any solution or work-around to stop this cmdlet timing out?
This issue maybe occurring due to a previous version of Az powershell module. Please update your Az module to the latest version and try again.
Also make sure you have the write permissions in the directory you are trying to create the json file.
Meanwhile, you can create the template from the portal just to check if the json file is getting created successfully:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/export-template-portal#export-template-from-a-resource-group

Azure cloud shell error

I am unable to do anything with my Azure account such as create servers or databases or anything. It seems like it all revolves around resource groups which I cannot create> I get this error:
It's especially tough because I can't even use a cloud shell since I get this:
Requesting a Cloud Shell.
PowerShell may take up to a minute.Failed to provision a Cloud Shell: {"code":"AuthenticationFailed","message":"Authentication failed. The 'Authoriza
tion' header is missing."}
Any idea what this could mean?
Do you have a valid subscription?
If you do make sure you have the right permissions to it.
Cloud shell need to create a storage to work. If you can't create any resource on subscription cloud shell will surely fail.

Resources