Introduction

This document outlines the procedure to extract a comprehensive inventory of Azure resources and resource providers using PowerShell. The resulting CSV files can be utilized for documentation, auditing, or migration planning purposes.


Prerequisites

  Connect-AzAccount

Exporting Azure Resources

To retrieve and export all Azure resources within the current subscription, execute the following command:

Get-AzResource | Export-Csv -Path "clientname.azservices.csv" -NoTypeInformation

This command performs the following actions:

  • Get-AzResource: Retrieves all resources in the current Azure subscription.

  • Export-Csv: Exports the retrieved data to a CSV file named clientname.azservices.csv in the current directory.

  • -NoTypeInformation: Omits the type information from the CSV file for cleaner output. 


The resulting CSV file will contain details such as resource names, types, locations, and associated resource groups.


Exporting Registered Resource Providers

To list all available Azure resource providers and their registration states, execute the following command:

Get-AzResourceProvider -ListAvailable | Select-Object ProviderNamespace, RegistrationState | Export-Csv -Path "clientname.regproviders.csv" -NoTypeInformation

This command performs the following actions:

  • Get-AzResourceProvider -ListAvailable: Retrieves all resource providers available in Azure.

  • Select-Object ProviderNamespace, RegistrationState: Selects only the ProviderNamespace and RegistrationState properties for clarity.

  • Export-Csv: Exports the selected data to a CSV file named clientname.regproviders.csv in the current directory.

  • -NoTypeInformation: Omits the type information from the CSV file for cleaner output.


The resulting CSV file will list each resource provider along with its current registration state (e.g., Registered, NotRegistered).


Notes

  • Replace clientname in the file names with your organization's name or a relevant identifier to maintain clarity.

  • Ensure that you have the necessary permissions to access and export resource information within your Azure subscription.

  • For exporting resources across multiple subscriptions, iterate through each subscription by setting the context using Set-AzContext before executing the export commands.