Dela via


Get-AzApiManagementSubscription

Hämtar prenumerationer.

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

Cmdleten Get-AzApiManagementSubscription hämtar en angiven prenumeration eller alla prenumerationer om ingen prenumeration har angetts. Nycklar tas inte med i resultatinformationen. Hämta nycklar genom att använda Get-AzApiManagementSubscriptionKey.

Exempel

Exempel 1: Hämta alla prenumerationer

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

Det här kommandot hämtar alla prenumerationer.

Exempel 2: Hämta en prenumeration med ett angivet ID

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

Det här kommandot hämtar en prenumeration efter ID.

Exempel 3: Hämta alla prenumerationer för en användare

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

Det här kommandot hämtar en användares prenumerationer.

Exempel 4: Hämta alla prenumerationer för en produkt

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

Det här kommandot hämtar alla prenumerationer för produkten.

Exempel 5: Hämta alla prenumerationer för ett omfång

$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

Det här kommandot hämtar alla prenumerationer som har konfigurerats för globalt API-omfång

Exempel 6: Hämta alla prenumerationer för en produkt och ett användaromfång

$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

Det här kommandot hämtar alla prenumerationer som har konfigurerats för globalt API-omfång

Parametrar

-Context

Anger ett PsApiManagementContext- objekt.

Typ:PsApiManagementContext
Position:Named
Standardvärde:None
Obligatorisk:True
Godkänn pipeline-indata:True
Godkänn jokertecken:False

-DefaultProfile

Autentiseringsuppgifter, konto, klientorganisation och prenumeration som används för kommunikation med Azure.

Typ:IAzureContextContainer
Alias:AzContext, AzureRmContext, AzureCredential
Position:Named
Standardvärde:None
Obligatorisk:False
Godkänn pipeline-indata:False
Godkänn jokertecken:False

-ProductId

Anger en produktidentifierare. Om den här cmdleten har angetts hittar den alla prenumerationer efter produktidentifieraren.

Typ:String
Position:Named
Standardvärde:None
Obligatorisk:True
Godkänn pipeline-indata:True
Godkänn jokertecken:False

-Scope

Omfångsidentifierare. Prenumerationens omfång, oavsett om det är Api Scope /apis/{apiId} eller Product Scope /products/{productId} eller Global API Scope /apis eller Global scope /.

Typ:String
Position:Named
Standardvärde:None
Obligatorisk:True
Godkänn pipeline-indata:True
Godkänn jokertecken:False

-SubscriptionId

Anger en prenumerationsidentifierare. Om det anges hittar den här cmdleten prenumerationen med identifieraren.

Typ:String
Position:Named
Standardvärde:None
Obligatorisk:False
Godkänn pipeline-indata:True
Godkänn jokertecken:False

-UserId

Anger en användaridentifierare. Om den här cmdleten anges hittar den alla prenumerationer efter användaridentifieraren.

Typ:String
Position:Named
Standardvärde:None
Obligatorisk:True
Godkänn pipeline-indata:True
Godkänn jokertecken:False

Indata

PsApiManagementContext

String

Utdata

PsApiManagementSubscription