Get-AzureSubscription
Azure アカウントの Azure サブスクリプションを取得します。
注意
このドキュメントで参照されているコマンドレットは、Service Management API を使用するレガシ Azure リソースを管理するためのものです。 Azure Resource Manager リソースを管理するためのコマンドレットについては、Az PowerShell モジュールを参照してください。
構文
Get-AzureSubscription
[-SubscriptionName <String>]
[-ExtendedDetails]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
Get-AzureSubscription
[-SubscriptionId <String>]
[-ExtendedDetails]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
Get-AzureSubscription
[-Default]
[-ExtendedDetails]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
Get-AzureSubscription
[-Current]
[-ExtendedDetails]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
説明
Get-AzureSubscription コマンドレットは、Azure アカウント内のサブスクリプションを取得します。 このコマンドレットを使用すると、サブスクリプションに関する情報を取得したり、サブスクリプションを他のコマンドレットにパイプしたりできます。
Get-AzureSubscription には、Azure アカウントへのアクセスが必要です。 Get-AzureSubscription を実行する前に、発行設定ファイル (Get-AzurePublishSettingsFile、Import-AzurePublishSettingsFile) をダウンロードしてインストールする Add-AzureAccount コマンドレットまたはコマンドレットを実行する必要があります。
このトピックでは、Microsoft Azure PowerShell モジュールの 0.8.10 バージョンのコマンドレットについて説明します。
使用しているモジュールのバージョンを取得するには、Azure PowerShell コンソールで「.」と入力します (Get-Module -Name Azure).Version
。
例
例 1: すべてのサブスクリプションを取得する
C:\PS>Get-AzureSubscription
このコマンドは、アカウント内のすべてのサブスクリプションを取得します。
例 2: 名前でサブスクリプションを取得する
C:\PS>Get-AzureSubscription -SubscriptionName "MyProdSubscription"
このコマンドは、"MyProdSubsciption" サブスクリプションのみを取得します。
例 3: 既定のサブスクリプションを取得する
C:\PS>(Get-AzureSubscription -Default).SubscriptionName
このコマンドは、既定のサブスクリプションの名前のみを取得します。 コマンドは最初にサブスクリプションを取得し、次に dot メソッドを使用してサブスクリプションの SubscriptionName プロパティを取得します。
例 4: 選択したサブスクリプションのプロパティを取得する
C:\PS>Get-AzureSubscription -Current | Format-List -Property SubscriptionName, Certificate
このコマンドは、現在のサブスクリプションの名前と証明書を含むリストを返します。 Get-AzureSubscription コマンドを使用して現在のサブスクリプションを取得します。 次に、選択したプロパティを一覧に 表示する Format-List コマンドにサブスクリプションをパイプ処理します。
例 5: 代替サブスクリプション データ ファイルを使用する
C:\PS>Get-AzureSubscription -SubscriptionDataFile "C:\Temp\MySubscriptions.xml"
このコマンドは、C:\Temp\MySubscriptions.xml サブスクリプション データ ファイルからサブスクリプションを取得します。 Add-AzureAccount または Import-PublishSettingsFile コマンドレットの実行時に代替サブスクリプション データ ファイルを指定した場合は、SubscriptionDataFile パラメーターを使用します。
パラメーター
-Current
現在のサブスクリプション 、つまり "current" として指定されたサブスクリプションのみを取得します。既定では、 Get-AzureSubscription は Azure アカウント内のすべてのサブスクリプションを取得します。 サブスクリプションを "current" として指定するには、Select-AzureSubscription コマンドレットの Current パラメーターを使用します。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Default
既定のサブスクリプション 、つまり "default" として指定されたサブスクリプションのみを取得します。既定では、 Get-AzureSubscription は Azure アカウント内のすべてのサブスクリプションを取得します。 サブスクリプションを "default" として指定するには、Select-AzureSubscription コマンドレットの Default パラメーターを使用します。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ExtendedDetails
標準設定に加えて、サブスクリプションのクォータ情報を返します。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Profile
このコマンドレットが読み取る Azure プロファイルを指定します。 プロファイルを指定しない場合、このコマンドレットはローカルの既定のプロファイルから読み取ります。
Type: | AzureSMProfile |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SubscriptionId
Type: | String |
Aliases: | Id |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SubscriptionName
指定したサブスクリプションのみを取得します。 サブスクリプション名を入力します。 値は、大文字小文字が区別されます。 ワイルドカード文字はサポートされていません。 既定では、 Get-AzureSubscription は Azure アカウント内のすべてのサブスクリプションを取得します。
Type: | String |
Aliases: | Name |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
入力
None
SubscriptionName プロパティへの入力は名前でパイプできますが、値によるパイプ処理は行いません。
出力
Microsoft.WindowsAzure.Commands.Utilities.Common.WindowsAzureSubscription
メモ
- Get-AzureSubscription は、Add-AzureAccount コマンドレットと Import-PublishSettingsFile コマンドレットによって作成されるサブスクリプション データ ファイルからデータを取得します。