none
retrieve opm_apim_subscription_key programmatically RRS feed

  • Question

  • I need a way to grab this key for an API programmatically so I can include it in my CI/CD pipeline for some apps that need it for their API calls.  I'm yet to find a way to get this outside of using the Azure portal to get it "manually".  

    I'm fine with using az cli, PowerShell, or even just the REST API if there is such an endpoint.   Thanks!

    Friday, November 22, 2019 6:14 PM

All replies

  • PowerShell:

    $name = "[Name of your API Management Service" $rg = "API Mangement Service Resource Group"

    $subscriptionId = "master" $context = New-AzApiManagementContext -ResourceGroupName $rg -ServiceName $name Get-AzApiManagementSubscription -Context $context -SubscriptionId $subscriptionId | Select-Object -ExpandProperty PrimaryKey


    Morten la Cour

    Friday, November 22, 2019 8:30 PM
  • That value does not match the value that I find in the HTTP request under the Test tab, and I have to pass in that key to access the api.

    Saturday, November 23, 2019 11:52 PM