1
votes

I'm looking for a way to use Azure API Management (either the management portal or an API call) to edit the textual description of the Ocp-Apim-Subscription-Key Request header fields. This string shows up in auto-generated documentation, but I can't figure out where it's set. So far I've tried looking for the description string for the Ocp-Apim-Subscription-Key in the swagger file and in the API Management Publisher Portal, but haven't been able to find it.

Here is a screenshot highlighting the field in the generated API documentation that I want to edit:

enter image description here

Here is the page in the Azure API Management Publisher Portal where I looked for a Request Headers section and couldn't find it: enter image description here

Other answers to questions about Azure API Management make me wonder if there's a REST API call to edit this string (if it's not available in the Publisher Portal) but I can't seem to find an active link to API documentation about it.

1
I checked the "operation" template in the developer portal. It seems that the particular text is not included in the template directly - it is provided by the backend in the data structure going into the template.Kai Walter

1 Answers

0
votes

I use a Azure PowerShell for that. Prerequisite is that you're logged in (Login-AzureRmAccount) and selected your subscription (Select-AzureRmSubscription).

 $ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName $resourceGroup -ServiceName $serviceName

if($ApiMgmtContext)
{
    foreach($apiEntry in (Get-AzureRmApiManagementApi -Context $ApiMgmtContext))
    {
        $api = Get-AzureRmApiManagementApi -Context $ApiMgmtContext -ApiId $apiEntry.ApiId

        Write-Host "setting header for" $api.Name

        $api.SubscriptionKeyHeaderName = "MyApi-Subscription-Key"
        $api | Set-AzureRmApiManagementApi -Context $ApiMgmtContext
    }
}