PowerShellでサブスクリプションの確認と選択

シェアする

  • このエントリーをはてなブックマークに追加
スポンサーリンク

目的

さて今回は、Azureアカウントによっては複数のサブスクリプションに関連付けられている場合に、特定のサブスクリプションを選択したいと思います。

手順

PowerShellで複数あるサブスクリプションを確認し、選択する手順をAzure Resource Manager(以下、ARM)とAzure Classic(以下、Classic)の2つのパターンを紹介します。

<ARM>

① ARMへログイン

② サブスクリプション確認

③ サブスクリプション選択

PowerShellコマンドプロンプト[ARM]

PS C:\WINDOWS\system32> Add-AzureRmAccount ・・・・・・・・・・①

PS C:\WINDOWS\system32> Get-AzureRmSubscription・・・・・・・・・②
SubscriptionName : 無料試用版
SubscriptionId : xxxxxx-d1aa-4cb7-xxxxxx-xxxxxx
TenantId : xxxxxx-ccf1-4835-xxxxxx-xxxxxx
State : Enabled

SubscriptionName : Microsoft Azure エンタープライズ
SubscriptionId : xxxxxx-f69b-4cd9-xxxxxx-xxxxxx
TenantId : xxxxxx-46fc-4a42-8c1d-dda618c81f8d
State : Enabled

PS C:\WINDOWS\system32> Select-AzureRmSubscription -SubscriptionName “無料試用版”・・・・・・・・・③

<Classic>

① Classicへログイン

② サブスクリプション確認

③ サブスクリプション選択

PowerShellコマンドプロンプト[Classic]

PS C:\WINDOWS\system32> Add-AzureAccount ・・・・・・・・・・①

PS C:\WINDOWS\system32> Get-AzureSubscription・・・・・・・・・②
SubscriptionName : 無料試用版
SubscriptionId : xxxxxx-d1aa-4cb7-xxxxxx-xxxxxx
TenantId : xxxxxx-ccf1-4835-xxxxxx-xxxxxx
State : Enabled

SubscriptionName : Microsoft Azure エンタープライズ
SubscriptionId : xxxxxx-f69b-4cd9-xxxxxx-xxxxxx
TenantId : xxxxxx-46fc-4a42-8c1d-dda618c81f8d
State : Enabled

PS C:\WINDOWS\system32> Select-AzureSubscription -SubscriptionName “無料試用版”・・・・・・・・・③

スポンサーリンク
スポンサーリンク

シェアする

  • このエントリーをはてなブックマークに追加

フォローする