You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/api-center/set-up-notification-workflow.md
+90-7Lines changed: 90 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,8 @@ This article shows how to set up a notification workflow for API approval in you
17
17
## Prerequisites
18
18
19
19
* 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).
21
21
* Permissions to....
22
-
23
22
* 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).
24
23
25
24
* For Azure CLI:
@@ -29,7 +28,7 @@ This article shows how to set up a notification workflow for API approval in you
29
28
30
29
## Add a managed identity in your API center
31
30
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.
33
32
34
33
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.
35
34
@@ -40,6 +39,7 @@ The following examples show how to configure a system-assigned managed identity
40
39
1. Select **System assigned**, and set the status to **On**.
41
40
1. Select **Save**.
42
41
42
+
43
43
#### [Azure CLI](#tab/cli)
44
44
45
45
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
48
48
az apic update --name <api-center-name> --resource-group <resource-group-name> --identity '{"type": "SystemAssigned"}'
49
49
```
50
50
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**.
52
64
65
+
## Configure Logic Apps event subscription
53
66
54
67
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.
55
68
@@ -71,7 +84,42 @@ This section provides the manual steps to configure an event subscription that t
71
84
1. In **Name**, enter *versionvar*.
72
85
1. In **Type**, select **String**.
73
86
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.
75
123
1. In the search box, enter *HTTP*. Under **Actions**, select **HTTP**. In the **HTTP** pane:
76
124
1. In **Method**, select **GET**.
77
125
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
85
133
1. In **Content**, select **Add dynamic content** > **Body**.
86
134
1. In **Schema**, select **Use sample payload to generate schema** and then enter the following:
87
135
```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
+
}
89
166
```
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
+
90
174
91
175
92
-
### Create a logic app
93
176
## Related content
94
177
95
178
* [Event Grid schema for Azure API Center](../event-grid/event-schema-api-center.md)
0 commit comments