アクセスできる全Azureサブスクリプションの全リソースを取得して一覧をCSVファイルに出力する
Microsoft Azure のリソース一覧が欲しくなることがあるが、Azure Portal には現在リソース一覧を出力する機能がない。(正確には、Azure Resource Explorer を使えば、JSON形式で取得することはできるかもしれない。)
CSV出力する Azure PowerShell コマンドを作ってくださっていた先人がいらっしゃったので、ありがたく拝借する。
元ネタ
https://gist.github.com/mahiya/42e39f451fb3a8cd683a
上記はAzureRMモジュール版のコマンドであったため、Azモジュール版に対応させた。
https://gist.github.com/yukit7s/b843298fec3c0b06f730b4df384cce71
動作確認済み環境
PowerShell Version: 3.2.0
Az module Version: 5.1.18362.1171
PowerShellとAzモジュールバージョン確認.ps1
$PSVersionTable
Get-InstalledModule Az
参考
- Azure PowerShell documentation
https://docs.microsoft.com/ja-jp/powershell/azure/?view=azps-5.2.0