I want to use an API, but I can't find the Ocp-Apim-Subscription-Key at the page below:
Where to find my Ocp-Apim-Subscription-Key in Windows Azure
89k views Asked by YJ. Yang AtThere are 9 answers
On
(August 2018) For our purposes (AI / ML) I found it under Cognitive Services > Resource Management > Keys - https://portal.azure.com/#blade/HubsExtension/Resources/resourceType/Microsoft.CognitiveServices%2Faccounts
It will be under other services though I can't say which (as you have to be using one to see the attributes of it).
On
Method 1: From https://portal.azure.com/ go to your API Management service -> Subscriptions There will find default ones and some created by your own.
Method 2: Via https://resources.azure.com/ using HTTP GET method
az rest --method get `
--uri 'https://management.azure.com/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP_NAME}/providers/Microsoft.ApiManagement/service/{API_MANAGER_NAME}/subscriptions?api-version=2018-01-01' `
--query "value[0].properties.primaryKey" | ConvertFrom-Json
Explanation:
- Replace placeholders {SUBSCRIPTION_ID},{API_MANAGER_NAME},{RESOURCE_GROUP_NAME} by your own values
- "value[0]. -> indicates the required key value: first,second in the list, because as you can see in the portal there are multiple for different scopes: Starter, Service access, Unlimited etc.
- properties.primaryKey -> each value has 2 defined keys: primaryKey and secondaryKey
- api-version=2018-01-01 -> check the right version, can be found from https://resources.azure.com/ or from ARM template for the API Manager resource
On
Not sure where everyone is getting their answers from...
Maybe it's just old information, but at this time you can find them by doing the following:
- Go to portal.azure.com
- Select "Create a resource"
- Create a resource. I'm using computer vision so I search for that and hit enter
- Select "create"
- Go to the newly created resource
- On the left side panel under the "Resource Management" section select "Keys and Endpoint"
Key 1 and Key 2 are used as the "Ocp-Apim-Subscription-Key".
That's it. Those should work for you wherever it asks for the "Ocp-Apim-Subscription-Key".
On
I found the subscription key here:
- In the Azure portal, navigate to the "API Management service".
- Go to "Subscriptions" under the "APIs"-heading.
- Press "Add subscription".
- Enter a "Name", select API as "Scope" then select your API under "API".
- Press "Save". This will create a subscription for the selected API.
- In the list of subscriptions, locate the subscription you just created, then press the "..."-button to the far right.
- Press "Show/hide keys".
- The subscription key is visible and can be copied from the "Primary key"-field.
On
A subscription key is associated to a subscription. You can go the specific API's subscription you want the keys to (Home / API Management services / [Your APIM] / Subscriptions / [Your API's subscription]), you'll find the keys clicking in in the ellipsis (three dots) button, option "Show/hide keys":



please, following the instructions below.