Skip to content

Commit ac222a5

Browse files
committed
wip
1 parent 409507f commit ac222a5

File tree

1 file changed

+90
-7
lines changed

1 file changed

+90
-7
lines changed

articles/api-center/set-up-notification-workflow.md

Lines changed: 90 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ This article shows how to set up a notification workflow for API approval in you
1717
## Prerequisites
1818

1919
* An API center in your Azure subscription. If you haven't created one already, see [Quickstart: Create your API center](set-up-api-center.md).
20-
* Set up a logic app? And limitations etc.?
20+
* A standard logic apps resource in your Azure subscription. If you haven't created one already, see [Create an example Standard workflow in single-tenant Azure Logic Apps with the Azure portal](../logic-apps/create-single-tenant-workflows-azure-portal.md).
2121
* Permissions to....
22-
2322
* The Event Grid resource provider registered in your subscription. If you need to register the Event Grid resource provider, see [Subscribe to events published by a partner with Azure Event Grid](../event-grid/subscribe-to-partner-events.md#register-the-event-grid-resource-provider).
2423

2524
* For Azure CLI:
@@ -29,7 +28,7 @@ This article shows how to set up a notification workflow for API approval in you
2928

3029
## Add a managed identity in your API center
3130

32-
For this scenario, your API center uses a [managed identity](/entra/identity/managed-identities-azure-resources/overview) to access a logic app workflow. Depending on your needs, configure either a system-assigned or one or more user-assigned managed identities.
31+
For this scenario, your API center uses a [managed identity](/entra/identity/managed-identities-azure-resources/overview) to access a logic app workflow. Depending on your needs, configure either a system-assigned or a user-assigned managed identity.
3332

3433
The following examples show how to configure a system-assigned managed identity by using the Azure portal or the Azure CLI. At a high level, configuration steps are similar for a user-assigned managed identity.
3534

@@ -40,6 +39,7 @@ The following examples show how to configure a system-assigned managed identity
4039
1. Select **System assigned**, and set the status to **On**.
4140
1. Select **Save**.
4241

42+
4343
#### [Azure CLI](#tab/cli)
4444

4545
Set the system-assigned identity in your API center using the following [az apic update](/cli/azure/apic#az-apic-update) command. Substitute the names of your API center and resource group:
@@ -48,8 +48,21 @@ Set the system-assigned identity in your API center using the following [az apic
4848
az apic update --name <api-center-name> --resource-group <resource-group-name> --identity '{"type": "SystemAssigned"}'
4949
```
5050

51-
## Configure Logic Apps event subscription
51+
## Add a custom metadata property
52+
53+
Add a [custom metadata property](metadata.md) to the API registration in your API center to set *api-status*.
54+
55+
1. In the [Azure portal](https://portal.azure.com), navigate to your API center.
56+
1. In the left menu, under **Assets**, select **Metadata** > **+ New metadata**.
57+
1. In the **Details** tab, enter the following details:
58+
1. In **Title**, enter *api-status*.
59+
1. In **Type**, select **Predefined choices**.
60+
1. Add the following predefined choices: *new*, *pending*, *approved*. Select **Next**.
61+
1. In the **Assignments** tab, next to **APIs**, select **Optional**.
62+
1. Optionally make assignments to **Deployments** and **Environments**. Select **Next**.
63+
1. Review the configuration and select **Create**.
5264

65+
## Configure Logic Apps event subscription
5366

5467
This section provides the manual steps to configure an event subscription that triggers a logic app workflow when an API is registered in your API center.
5568

@@ -71,7 +84,42 @@ This section provides the manual steps to configure an event subscription that t
7184
1. In **Name**, enter *versionvar*.
7285
1. In **Type**, select **String**.
7386
1. In **Value**, enter `?api-version=2024-03-01`. Select **OK**.
74-
1. Select **+ New step**.
87+
1. Select **Save as** to save your logic app workflow that you've configured so far.
88+
1. In the **Create a logic app** pane, enter a name for your logic app.
89+
1. Optionally configure other settings. Select **Create**.
90+
91+
> [!NOTE]
92+
> You'll continue configuring the logic app workflow in a later section, after configuring a managed identity in the logic app and testing the event subscription.
93+
94+
## Enable a managed identity in your logic app
95+
96+
For this scenario, the logic app uses a managed identity to access the Azure API center. Depending on your needs, configure either a system-assigned or user-assigned managed identity. For configuration steps, see [Authenticate access and connections to Azure resources with managed identities in Azure Logic Apps](../logic-apps/authenticate-with-managed-identity.md).
97+
98+
Assign the logic app managed identity the necessary permissions to access the API center. For this scenario, assign the **Contributor** role to the managed identity.
99+
100+
1. In the [Azure portal](https://portal.azure.com), navigate to your API center and select **Access control (IAM)**.
101+
1. Select **+ Add > Add role assignment**.
102+
1. Select **Privileged administrator roles** and then select **Contributor**. Select **Next**.
103+
1. On the **Members** page, in **Assign access to**, select **Managed identity > + Select members**.
104+
1. On the **Select managed identities** page, search for and select the managed identity of the function app. Click **Select** and then **Next**.
105+
1. Review the role assignment, and select **Review + assign**.
106+
107+
108+
## Test the event subscription
109+
110+
To test the event subscription, register an API in your API center. The event subscription triggers the logic app workflow when the API is registered.
111+
112+
1. In the [Azure portal](https://portal.azure.com), navigate to your logic app.
113+
1. In the left menu, under **Developer Tools**, select **Run History**.
114+
1. Check the status of the logic app run. If the logic app run has a status of **Succeeded**, select the run to see the details.
115+
1. Select the **When a resource event occurs** pane at the top of the workflow.
116+
1. Review the **Inputs** section to confirm that the `Microsoft.ApiCenter.ApiAdded` event was triggered.
117+
1. Review the **body** of the **Outputs** section to confirm that the event data was received by the logic app.
118+
119+
## Continue configuration of the logic app workflow
120+
121+
1. In the left menu of the logic app, under **Developer Tools**, select **Logic app designer**.
122+
1. Insert an action after the last step you configured previously.
75123
1. In the search box, enter *HTTP*. Under **Actions**, select **HTTP**. In the **HTTP** pane:
76124
1. In **Method**, select **GET**.
77125
1. In **URI**, enter `https://management.azure.com/`. Select **Add dynamic content** and then select variables *subjectvar* and *versionvar*.
@@ -85,11 +133,46 @@ This section provides the manual steps to configure an event subscription that t
85133
1. In **Content**, select **Add dynamic content** > **Body**.
86134
1. In **Schema**, select **Use sample payload to generate schema** and then enter the following:
87135
```json
88-
<!-- Where do I get the schema?? -->
136+
{
137+
"type": "object",
138+
"properties": {
139+
"id": {
140+
"type": "string"
141+
},
142+
"topic": {
143+
"type": "string"
144+
},
145+
"subject": {
146+
"type": "string"
147+
},
148+
"data": {
149+
"type": "object",
150+
"properties": {}
151+
},
152+
"eventType": {
153+
"type": "string"
154+
},
155+
"dataVersion": {
156+
"type": "string"
157+
},
158+
"metadataVersion": {
159+
"type": "string"
160+
},
161+
"eventTime": {
162+
"type": "string"
163+
}
164+
}
165+
}
89166
```
167+
1. Select **+ New step**.
168+
1. Select **Variables** > **Initialize variable**. In the **Initialize variable** pane:
169+
1. In **Name**, enter *customPropertiesVariable*.
170+
1. In **Type**, select **String**.
171+
1. In **Value**, select **Add dynamic content**. Select
172+
173+
90174

91175

92-
### Create a logic app
93176
## Related content
94177

95178
* [Event Grid schema for Azure API Center](../event-grid/event-schema-api-center.md)

0 commit comments

Comments
 (0)