Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Get-AzApiManagementSubscription command returns the subscription list but the keys values are empty

When i’m running in my machine the commands

$apimContext = New-AzApiManagementContext -ResourceGroupName "xxxxxxxxxxxxx" -ServiceName "xxxxxxxxx"

Get-AzApiManagementProduct -Context $apimContext -ProductId "xxxxxxxxx"

Get-AzApiManagementSubscription -Context $apimContext -ProductId "xxxxxxxxx"

The result is a subscription object with empty keys

SubscriptionId    : xxxxxxxxxxxxxxxx
UserId            : 1
OwnerId           : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/xxxx 
                    xxxx/providers/Microsoft.ApiManagement/service/xxxxx 
                    xxxxx/users/1
ProductId         : xxxxxx
Scope             : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/xxxx 
                    xxxx/providers/Microsoft.ApiManagement/service/xxxxx 
                    xxxx/products/xxxxxx
Name              : 
State             : Active
CreatedDate       : 29/04/2022 15:03:33
StartDate         : 29/04/2022 00:00:00
ExpirationDate    : 
EndDate           : 
NotificationDate  : 
PrimaryKey        : 
SecondaryKey      : 
StateComment      : 
AllowTracing      : True
Id                : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/xxxxx 
                    xxxxx/providers/Microsoft.ApiManagement/service/xxxxx 
                    xxxx/products/xxxxxx/subscriptions/xxxxxxxxxxxxxxx   
ResourceGroupName : xxxxxxxxxxxxxx
ServiceName       : xxxxxxxxxxx

As we can see the keys appear empty, but in the documentation examples it provides values. If i go to azure portal with my account i can see the values

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

Is there something i can do when running in a personal machine or in an azure pipeline so that i can get the key values?

>Solution :

The code result examples conflict with the documentation for Get-AzApiManagementSubscription

The Get-AzApiManagementSubscription cmdlet gets a specified
subscription, or all subscriptions, if no subscription is specified.
Keys will not be included into result details. To get keys, use
Get-AzApiManagementSubscriptionKey
.

See Get-AzApiManagementSubscriptionKey

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading