Skip to content

Commit fb3ffb5

Browse files
Merge pull request #307496 from MicrosoftDocs/main
Auto Publish – main to live - 2025-10-29 05:00 UTC
2 parents 804c2f7 + fc9c313 commit fb3ffb5

10 files changed

Lines changed: 196 additions & 125 deletions

File tree

articles/api-management/api-management-howto-setup-delegation.md

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,53 @@
11
---
2-
title: How to delegate user registration and product subscription
3-
description: Learn how to delegate user registration and product subscription to a third party in Azure API Management.
2+
title: How to Delegate User Registration and Product Subscription
3+
description: Learn how to delegate user registration and product subscription to a third party in the Azure API Management developer portal.
44
author: dlepow
55
services: api-management
66

77
ms.service: azure-api-management
88
ms.topic: how-to
9-
ms.date: 05/24/2025
9+
ms.date: 10/24/2025
1010
ms.author: danlep
1111
---
1212

1313
# How to delegate user registration and product subscription
1414

1515
[!INCLUDE [api-management-availability-premium-dev-standard-basic-premiumv2-standardv2-basicv2](../../includes/api-management-availability-premium-dev-standard-basic-premiumv2-standardv2-basicv2.md)]
1616

17-
Delegation enables your website to own the user data and perform custom validation. With delegation, you can handle developer sign-in/sign-up (and related account management operations) and product subscription using your existing website, instead of the developer portal's built-in functionality.
17+
Delegation enables your website to own the user data and perform custom validation for users of the developer portal. With delegation, you can handle developer sign-in and sign-up (and related account management operations) and product subscription by using your existing website, instead of the developer portal's built-in functionality.
1818

1919
## Delegating developer sign-in and sign-up
2020

21-
To delegate developer sign-in and sign-up and developer account management options to your existing website, create a special delegation endpoint on your site. This special delegation acts as the entry-point for any sign-in/sign-up and related requests initiated from the API Management developer portal.
21+
To delegate developer sign-in and sign-up and developer account management options to your existing website, create a special delegation endpoint on your site. This special delegation acts as the entry point for any sign-in/sign-up and related requests initiated from the API Management developer portal.
2222

23-
The final workflow will be:
23+
The final workflow consists of these steps:
2424

25-
1. Developer clicks on the sign-in or sign-up link or an account management link at the API Management developer portal.
25+
1. Developer clicks the sign-in or sign-up link or an account management link at the API Management developer portal.
2626
1. Browser redirects to the delegation endpoint.
2727
1. Delegation endpoint in return redirects user to or presents user with sign-in/sign-up or account management UI.
2828
1. After the operation completes, user is redirected back to the API Management developer portal at the location they left.
2929

30-
### Set up API Management to route requests via delegation endpoint
30+
### Set up API Management to route requests through a delegation endpoint
3131

32-
1. In the [Azure portal](https://portal.azure.com), navigate to your API Management instance.
33-
1. In the left menu, under **Developer portal**, select **Delegation**.
34-
1. Click the checkbox to enable **Delegate sign-in & sign-up**.
32+
1. In the [Azure portal](https://portal.azure.com), go to your API Management instance.
33+
1. In the sidebar menu, under **Developer portal**, select **Delegation**.
34+
1. Select the checkbox to **Enable delegation**.
35+
1. Select the checkbox to enable **Delegate sign-in & sign-up**.
3536

36-
:::image type="content" source="media/api-management-howto-setup-delegation/api-management-delegation-signin-up.png" alt-text="Screenshot showing delegation of sign-in and sign-up in the portal.":::
37+
:::image type="content" source="media/api-management-howto-setup-delegation/api-management-delegation-sign-in-up.png" alt-text="Screenshot showing delegation of sign-in and sign-up in the portal.":::
3738

38-
1. Decide your special delegation endpoint's URL and enter it in the **Delegation endpoint URL** field.
39-
1. Within the **Delegation Validation Key** field, either:
40-
* Enter a secret used to compute a signature provided for verification that the request originates from API Management.
41-
* Click the **Generate** button for API Management to generate a random key for you.
42-
1. Click **Save**.
39+
1. Choose the URL for your special delegation endpoint and enter it in the **Delegation service endpoint** field.
40+
1. In **Delegation keys**:
41+
* Generate the **Primary validation key** or **Secondary validation key** (or both) to use by your delegation service to validate requests from API Management. Select the ellipsis (**...**) next to either key and then select **Regenerate**.
42+
* Select the ellipsis (**...**) next to either key and then select **Copy**. Copy the keys to a secure location, and use them when configuring your delegation service.
43+
1. Select **Save**.
44+
45+
> [!TIP]
46+
> You can rotate and regenerate the delegation validation keys at any time. Rotation replaces the primary key with the secondary key, and regenerates the secondary key. After saving the keys, make sure to update your delegation service to use the new keys.
4347
4448
### Create your delegation endpoint
4549

46-
Recommended steps for creating a new delegation endpoint to implement on your site:
50+
To create a new delegation endpoint to implement on your site, follow these steps:
4751

4852
1. Receive a request in the following form, depending on the operation:
4953

@@ -97,22 +101,22 @@ Recommended steps for creating a new delegation endpoint to implement on your si
97101

98102
## Delegating product subscription
99103

100-
Delegating product subscriptions works similarly to delegating user sign-in/sign-up. The final workflow would be as follows:
104+
Delegating product subscriptions works similarly to delegating user sign-in/sign-up. The final workflow consists of these steps:
101105

102-
1. Developer selects a product in the API Management developer portal and clicks on the **Subscribe** button.
106+
1. Developer selects a product in the API Management developer portal and selects the **Subscribe** button.
103107
1. Browser redirects to the delegation endpoint.
104-
1. Delegation endpoint performs required product subscription steps, which you design. They may include:
108+
1. Delegation endpoint performs required product subscription steps, which you design. These steps could include:
105109
* Redirecting to another page to request billing information.
106-
* Asking additional questions.
110+
* Asking further questions.
107111
* Storing the information and not requiring any user action.
108112

109113
### Enable the API Management functionality
110114

111-
On the **Delegation** page, click **Delegate product subscription**.
115+
On the **Delegation** page, select the checkbox to **Enable delegation**, and then enable **Delegate product subscription**.
112116

113117
### Create your delegation endpoint
114118

115-
Recommended steps for creating a new delegation endpoint to implement on your site:
119+
To create a new delegation endpoint for your site, follow these steps:
116120

117121
1. Receive a request in the following form, depending on the operation.
118122

@@ -127,14 +131,14 @@ Recommended steps for creating a new delegation endpoint to implement on your si
127131

128132
| Parameter | Description |
129133
| --------- | ----------- |
130-
| **operation** | Identifies the delegation request type. Valid product subscription requests options are: <ul><li>**Subscribe**: a request to subscribe the user to a given product with provided ID (see below).</li><li>**Unsubscribe**: a request to unsubscribe a user from a product</li></ul> |
134+
| **operation** | Identifies the delegation request type. Valid product subscription request options are: <ul><li>**Subscribe**: a request to subscribe the user to a given product with provided ID (see below).</li><li>**Unsubscribe**: a request to unsubscribe a user from a product</li></ul> |
131135
| **productId** | On *Subscribe*, the product ID that the user requested subscription. |
132136
| **userId** | On *Subscribe*, the requesting user's ID. |
133137
| **subscriptionId** | On *Unsubscribe*, the product subscription ID. |
134138
| **salt** | A special salt string used for computing a security hash. |
135139
| **sig** | A computed security hash used for comparison to your own computed hash. |
136140

137-
1. Verify that the request is coming from Azure API Management (optional, but highly recommended for security)
141+
1. Verify that the request comes from Azure API Management (optional, but highly recommended for security).
138142

139143
* Compute an HMAC-SHA512 of a string based on the **productId** and **userId** (or **subscriptionId**) and **salt** query parameters:
140144

@@ -148,16 +152,16 @@ Recommended steps for creating a new delegation endpoint to implement on your si
148152
HMAC(salt + '\n' + subscriptionId)
149153
```
150154
151-
* Compare the above-computed hash to the value of the **sig** query parameter. If the two hashes match, move on to the next step. Otherwise, deny the request.
155+
* Compare the above-computed hash to the value of the **sig** query parameter. If the two hashes match, move to the next step. Otherwise, deny the request.
152156
1. Process the product subscription based on the operation type requested in **operation** (for example: billing, further questions, etc.).
153157
1. After completing the operation on your side, manage the subscription in API Management. For example, subscribe the user to the API Management product by [calling the REST API for subscriptions].
154158
155159
## Example code
156160
157-
These code samples show how to generate the hash of the `returnUrl` query parameter when delegating user sign-in or sign-up. The `returnUrl` is the URL of the page where the user clicked on the sign-in or sign-up link.
161+
These code samples show how to generate the hash of the `returnUrl` query parameter when delegating user sign-in or sign-up. The `returnUrl` is the URL of the page where the user clicked the sign-in or sign-up link.
158162
159-
* Take the *delegation validation key*, which is set in the **Delegation** screen of the Azure portal.
160-
* Create an HMAC, which validates the signature, proving the validity of the passed returnUrl.
163+
* Take the *delegation validation key*, which you set in the **Delegation** screen of the Azure portal.
164+
* Create an HMAC, which validates the signature and proves the validity of the passed `returnUrl`.
161165
162166
With slight modification, you can use the same code to calculate other hashes, such as with `productId` and `userId` when delegating product subscription.
163167
@@ -199,8 +203,8 @@ var signature = digest.toString('base64');
199203
> You need to [republish the developer portal](developer-portal-overview.md#publish-the-portal) for the delegation changes to take effect.
200204
201205
## Related content
202-
- [Learn more about the developer portal.](api-management-howto-developer-portal.md)
203-
- [Authenticate using Microsoft Entra ID](api-management-howto-aad.md) or with [Microsoft Entra External ID](/entra/external-id/customers/overview-customers-ciam).
206+
- [Learn more about the developer portal](api-management-howto-developer-portal.md)
207+
- [Authenticate using Microsoft Entra ID](api-management-howto-aad.md) or with [Microsoft Entra External ID](/entra/external-id/customers/overview-customers-ciam)
204208
- More developer portal questions? [Find answers in our FAQ](developer-portal-faq.md).
205209

206210
[Delegating developer sign-in and sign-up]: #delegate-signin-up
179 KB
Loading

0 commit comments

Comments
 (0)