다음을 통해 공유


Get-AzApiManagementSubscription

구독을 가져옵니다.

Syntax

Get-AzApiManagementSubscription
   -Context <PsApiManagementContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzApiManagementSubscription
   -Context <PsApiManagementContext>
   [-SubscriptionId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzApiManagementSubscription
   -Context <PsApiManagementContext>
   -UserId <String>
   -ProductId <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzApiManagementSubscription
   -Context <PsApiManagementContext>
   [-UserId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzApiManagementSubscription
   -Context <PsApiManagementContext>
   [-ProductId <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzApiManagementSubscription
   -Context <PsApiManagementContext>
   -Scope <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

구독이 지정되지 않은 경우 Get-AzApiManagementSubscription cmdlet은 지정된 구독 또는 모든 구독을 가져옵니다. 키는 결과 세부 정보에 포함되지 않습니다. 키를 얻으려면 Get-AzApiManagementSubscriptionKey를 사용합니다.

예제

예제 1: 모든 구독 가져오기

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-East-US" -ServiceName "contoso"
Get-AzApiManagementSubscription -Context $apimContext

이 명령은 모든 구독을 가져옵니다.

예제 2: 지정된 ID를 사용하여 구독 가져오기

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-East-US" -ServiceName "contoso"
Get-AzApiManagementSubscription -Context $apimContext -SubscriptionId "0123456789"

이 명령은 ID별로 구독을 가져옵니다.

예제 3: 사용자에 대한 모든 구독 가져오기

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-East-US" -ServiceName "contoso"
Get-AzApiManagementSubscription -Context $apimContext -UserId "777"

이 명령은 사용자의 구독을 가져옵니다.

예제 4: 제품에 대한 모든 구독 가져오기

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-East-US" -ServiceName "contoso"
Get-AzApiManagementSubscription -Context $apimContext -ProductId "999"

이 명령은 제품에 대한 모든 구독을 가져옵니다.

예제 5: 범위에 대한 모든 구독 가져오기

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-East-US" -ServiceName "contoso"
Get-AzApiManagementSubscription -Context $apimContext -Scope "/apis"

SubscriptionId    : allApScope
UserId            :
OwnerId           :
ProductId         :
Scope             : /subscriptions/subid/resourceGroups/Api-Default-East-US/providers/Microsoft.ApiManagement/service/contoso/apis
Name              : All Api Scope
State             : Active
CreatedDate       : 6/18/2019 5:53:49 PM
StartDate         :
ExpirationDate    :
EndDate           :
NotificationDate  :
PrimaryKey        :
SecondaryKey      :
StateComment      :
AllowTracing      : False
Id                : /subscriptions/subid/resourceGroups/Api-Default-East-US/providers/Microsoft.ApiManagement/service/contoso/subscriptions/allApScope
ResourceGroupName : Api-Default-East-US
ServiceName       : contoso

이 명령은 전역 API 범위에 대해 구성된 모든 구독을 가져옵니다.

예제 6: 제품 및 사용자 범위에 대한 모든 구독 가져오기

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-East-US" -ServiceName "contoso"
Get-AzApiManagementSubscription -Context $apimContext -ProductId 59b872f28a82740f547e6270 -UserId 1

SubscriptionId    : 59b872f38a82741750c8da56
UserId            : 1
OwnerId           : /subscriptions/subid/resourceGroups/Api-Default-East-US/providers/Microsoft.ApiManagement/service/contoso/users/1
ProductId         : 59b872f28a82740f547e6270
Scope             : /subscriptions/subid/resourceGroups/Api-Default-East-US/providers/Microsoft.ApiManagement/service/contoso/products/59b872f28a82740f547e6270
Name              :
State             : Active
CreatedDate       : 9/12/2017 11:51:15 PM
StartDate         : 9/12/2017 12:00:00 AM
ExpirationDate    :
EndDate           :
NotificationDate  :
PrimaryKey        :
SecondaryKey      :
StateComment      :
AllowTracing      : True
Id                : /subscriptions/subid/resourceGroups/Api-Default-East-US/providers/Microsoft.ApiManagement/service/contoso/subscriptions/59b872f38a82741750c8da56
ResourceGroupName : Api-Default-East-US
ServiceName       : contoso

이 명령은 전역 API 범위에 대해 구성된 모든 구독을 가져옵니다.

매개 변수

-Context

PsApiManagementContext 개체를 지정합니다.

Type:PsApiManagementContext
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

Azure와의 통신에 사용되는 자격 증명, 계정, 테넌트 및 구독입니다.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ProductId

제품 식별자를 지정합니다. 지정된 경우 이 cmdlet은 제품 식별자를 통해 모든 구독을 찾습니다.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Scope

범위 식별자입니다. Api Scope /api/{apiId} 또는 Product Scope /products/{productId} 또는 Global API Scope /api 또는 Global scope /이든 구독의 범위입니다.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SubscriptionId

구독 식별자를 지정합니다. 지정된 경우 이 cmdlet은 식별자가 구독을 찾습니다.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-UserId

사용자 식별자를 지정합니다. 지정된 경우 이 cmdlet은 사용자 식별자를 통해 모든 구독을 찾습니다.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

입력

PsApiManagementContext

String

출력

PsApiManagementSubscription