Azure APIM Subscription Keys
APIM → Subscription Keys → Secure API Access
Learn how to use subscription keys to control access to APIs in Azure API Management
Overview (Simple Explanation)
Azure API Management (APIM) uses subscription keys to identify clients and control access to APIs. Every request to a protected API must include a subscription key.
APIM subscription responsibilities:
- Authenticate requests using subscription keys
- Enforce product access and usage limits
- Monitor API consumption
Step 1: Create a Product in APIM
Products group APIs and control access via subscription keys.
- Azure Portal → API Management instance → Products
- Click Add Product
- Name:
My-API-Product - Set approval required: Yes/No depending on access policy
- Save the product
Step 2: Add APIs to Product
Associate your APIs with the product so subscription keys can access them.
- Go to the Product → APIs tab → Add APIs
- Select the APIs you want included
- Save changes
Step 3: Create or Assign Subscription Keys
Subscription keys can be auto-generated or manually assigned to users or groups.
- Go to Product → Subscriptions
- Click Add Subscription
- Provide name, owner (user/group), and optional primary/secondary keys
- Save subscription
Step 4: Call API Using Subscription Key
Include the subscription key in the request header or query string.
// Using header GET https://<apim-name>.azure-api.net/myapi/endpoint Ocp-Apim-Subscription-Key: <subscription-key> // Using query string GET https://<apim-name>.azure-api.net/myapi/endpoint?subscription-key=<subscription-key>
Step 5: Monitor & Manage Subscription Keys
- Check usage and quotas for each subscription
- Regenerate primary or secondary keys if compromised
- Enable or disable subscriptions as needed
- Track consumption in APIM Analytics
Final Understanding (One Line)
Subscription keys in APIM control access → Associate APIs with products → Monitor usage and enforce quotas.
💡 Clarifications & FAQ
1. What is a subscription key in APIM?
A subscription key is a unique identifier issued by APIM to clients to access APIs. It ensures authorized consumption and tracks usage.
2. How do I assign a subscription key to a user?
- Go to Product → Subscriptions → Add Subscription
- Enter the user or group as the owner
- Save subscription
3. Can I regenerate keys?
Yes, primary or secondary keys can be regenerated at any time to maintain security.
4. How do I use subscription keys?
Include them in HTTP requests either as a header (Ocp-Apim-Subscription-Key) or query string (?subscription-key=).
5. How do products relate to subscription keys?
Products define which APIs are accessible with a subscription key and enforce quotas, usage limits, and policies.
6. Where can I monitor API usage?
Use APIM Analytics to view request count, subscriptions, quotas, and throttling for all products and APIs.




