Reputation: 117
I have an azure subscription and I'm trying to write a powershell script to automatically get a list of all the resources (VMs, Storage Accounts, Databases, etc) that I currently have in my subscription. Is there any way to perform this.
Upvotes: 0
Views: 10304
Reputation: 36
To take this a step further, if you have multiple subscriptions, you can get all resources from all subscriptions using the following command:
get-azurermsubscription | Foreach-object{set-azurermcontext -Subscription $_.SubscriptionId; get-azurermresource}
Upvotes: -1
Reputation: 41
Just as an update; Find-AzureRMResource will actually get you all the resources in a given scope eg. everything in a resource group or subscription. Which may be more useful if you don't want to specify multiple parameters.
Upvotes: 0
Reputation: 136196
The PowerShell Cmdlet you're looking for is Get-AzureRMResource
. It will list all the resources in your Azure Subscription. It will provide the name, resource id, type, resource group name and location for each and every resource in your Subscription.
Upvotes: 4