|
| 1 | +--- |
| 2 | +title: TBD - Azure API Center |
| 3 | +description: TBD. |
| 4 | +ms.service: api-center |
| 5 | +ms.topic: how-to |
| 6 | +ms.date: 07/24/2024 |
| 7 | +ms.author: danlep |
| 8 | +author: dlepow |
| 9 | +ms.custom: |
| 10 | +# Customer intent: As an API program manager, I want to automate a workflow for an individual to receive a Microsoft Teams notification to approve an API that is registered in my organization's API center. |
| 11 | +--- |
| 12 | + |
| 13 | +# Set up a notification workflow for API approval in your Azure API center |
| 14 | + |
| 15 | +This article shows how to set up a notification workflow for API approval in your organization's [API center](overview.md) using [Azure Logic Apps](../logic-apps/logic-apps-overview.md) and Microsoft Teams. A logic app workflow sends a notification to a designated individual when an API is registered in the API center. The individual can then approve or reject the API registration directly from the notification in Microsoft Teams. |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 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.? |
| 21 | +* Permissions to.... |
| 22 | + |
| 23 | +* 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 | + |
| 25 | +* For Azure CLI: |
| 26 | + [!INCLUDE [include](~/reusable-content/azure-cli/azure-cli-prepare-your-environment-no-header.md)] |
| 27 | + |
| 28 | + [!INCLUDE [install-apic-extension](includes/install-apic-extension.md)] |
| 29 | + |
| 30 | +## Add a managed identity in your API center |
| 31 | + |
| 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. |
| 33 | + |
| 34 | +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 | + |
| 36 | +#### [Portal](#tab/portal) |
| 37 | + |
| 38 | +1. In the [portal](https://azure.microsoft.com), navigate to your API center. |
| 39 | +1. In the left menu, under **Security**, select **Managed identities**. |
| 40 | +1. Select **System assigned**, and set the status to **On**. |
| 41 | +1. Select **Save**. |
| 42 | + |
| 43 | +#### [Azure CLI](#tab/cli) |
| 44 | + |
| 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: |
| 46 | + |
| 47 | +```azurecli |
| 48 | +az apic update --name <api-center-name> --resource-group <resource-group-name> --identity '{"type": "SystemAssigned"}' |
| 49 | +``` |
| 50 | + |
| 51 | +## Configure Logic Apps event subscription |
| 52 | + |
| 53 | + |
| 54 | +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 | + |
| 56 | +1. In the [Azure portal](https://portal.azure.com), navigate to your API center. |
| 57 | +1. In the left menu, select **Events** > **Logic Apps**. |
| 58 | +1. Select **Sign in** to sign in to your Azure account. |
| 59 | +<!-- Which authentication method should customer choose? --> |
| 60 | +1. In the **When a resource event occurs** pane: |
| 61 | + 1. Select **Microsoft.ApiCenter.Services** as the **Resource type**. |
| 62 | + 1. In **Resource Name**, confirm the name of your API center. |
| 63 | + 1. In **Event Type Item - 1**, select **Microsoft.ApiCenter.ApiAdded**. |
| 64 | + 1. Select **+ New step**. |
| 65 | +1. Select **Variables** > **Initialize variable**. In the **Initialize variable** pane: |
| 66 | + 1. In **Name**, enter *subjectvar*. |
| 67 | + 1. In **Type**, select **String**. |
| 68 | + 1. In **Value**, select **Add dynamic content** > **Expression**. Enter `triggerBody()?['subject']`. Select **OK**. |
| 69 | + 1. Select **+ New step**. |
| 70 | +1. Select **Variables** > **Initialize variable**. In the **Initialize variable** pane: |
| 71 | + 1. In **Name**, enter *versionvar*. |
| 72 | + 1. In **Type**, select **String**. |
| 73 | + 1. In **Value**, enter `?api-version=2024-03-01`. Select **OK**. |
| 74 | + 1. Select **+ New step**. |
| 75 | +1. In the search box, enter *HTTP*. Under **Actions**, select **HTTP**. In the **HTTP** pane: |
| 76 | + 1. In **Method**, select **GET**. |
| 77 | + 1. In **URI**, enter `https://management.azure.com/`. Select **Add dynamic content** and then select variables *subjectvar* and *versionvar*. |
| 78 | + 1. Select **Add new parameter**. Select **Authentication**. |
| 79 | + 1. In **Authentication type**, select **Managed Identity**. |
| 80 | + 1. In **Managed identity**, select **System-assigned managed identity**. |
| 81 | + 1. In **Audience**, enter `https://management.azure.com/`. |
| 82 | + <!-- There's a validation note "Please enable managed identity for the logic app. Expected?? --> |
| 83 | + 1. Select **+ New step**. |
| 84 | +1. In the search box, enter *Parse JSON*. Under **Actions**, select **Parse JSON**. In the **Parse JSON** pane: |
| 85 | + 1. In **Content**, select **Add dynamic content** > **Body**. |
| 86 | + 1. In **Schema**, select **Use sample payload to generate schema** and then enter the following: |
| 87 | + ```json |
| 88 | + <!-- Where do I get the schema?? --> |
| 89 | + ``` |
| 90 | + |
| 91 | + |
| 92 | +### Create a logic app |
| 93 | +## Related content |
| 94 | + |
| 95 | +* [Event Grid schema for Azure API Center](../event-grid/event-schema-api-center.md) |
0 commit comments