Skip to content

Commit 62b0984

Browse files
authored
Merge pull request #234646 from saragluna/patch-2
Update the ASA calling Azure Func using MI authentication doc
2 parents e75ad18 + 61dc830 commit 62b0984

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed
270 KB
Loading
259 KB
Loading

articles/spring-apps/tutorial-managed-identities-functions.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: margard
66
ms.service: spring-apps
77
ms.custom: event-tier1-build-2022, devx-track-java, devx-track-azurecli
88
ms.topic: tutorial
9-
ms.date: 07/10/2020
9+
ms.date: 04/24/2023
1010
---
1111

1212
# Tutorial: Use a managed identity to invoke Azure Functions from an Azure Spring Apps app
@@ -25,7 +25,7 @@ Both Azure Functions and App Services have built in support for Azure Active Dir
2525
- An Azure subscription. If you don't have a subscription, create a [free account](https://azure.microsoft.com/free/) before you begin.
2626
- [Azure CLI](/cli/azure/install-azure-cli) version 2.45.0 or higher.
2727
- [Apache Maven](https://maven.apache.org/download.cgi) version 3.0 or higher.
28-
- [Install the Azure Functions Core Tools](../azure-functions/functions-run-local.md#install-the-azure-functions-core-tools) version 3.0.2009 or higher.
28+
- [Install the Azure Functions Core Tools](../azure-functions/functions-run-local.md#install-the-azure-functions-core-tools) version 4.x.
2929

3030
## Create a resource group
3131

@@ -62,7 +62,7 @@ az functionapp create \
6262
--os-type windows \
6363
--runtime node \
6464
--storage-account <storage-account-name> \
65-
--functions-version 3
65+
--functions-version 4
6666
```
6767

6868
Make a note of the returned `hostNames` value, which is in the format *https://\<your-functionapp-name>.azurewebsites.net*. Use this value in the Function app's root URL for testing the Function app.
@@ -75,18 +75,28 @@ Use the following steps to enable Azure Active Directory authentication to acces
7575
1. In the navigation pane, select **Authentication** and then select **Add identity provider** on the main pane.
7676
1. On the **Add an identity provider** page, select **Microsoft** from the **Identity provider** dropdown menu.
7777

78-
:::image type="content" source="media/spring-cloud-tutorial-managed-identities-functions/add-identity-provider.png" alt-text="Screenshot of the Azure portal showing the Add an identity provider page with Microsoft highlighted in the identity provider dropdown menu." lightbox="media/spring-cloud-tutorial-managed-identities-functions/add-identity-provider.png":::
78+
:::image type="content" source="media/tutorial-managed-identities-functions/add-identity-provider.png" alt-text="Screenshot of the Azure portal showing the Add an identity provider page with Microsoft highlighted in the identity provider dropdown menu." lightbox="media/tutorial-managed-identities-functions/add-identity-provider.png":::
7979

8080
1. Select **Add**.
8181
1. For the **Basics** settings on the **Add an identity provider** page, set **Supported account types** to **Any Azure AD directory - Multi-tenant**.
8282
1. Set **Unauthenticated requests** to **HTTP 401 Unauthorized: recommended for APIs**. This setting ensures that all unauthenticated requests are denied (401 response).
8383

84-
:::image type="content" source="media/spring-cloud-tutorial-managed-identities-functions/identity-provider-settings.png" alt-text="Screenshot of the Azure portal showing the settings page for adding an identity provider. This page highlights the 'supported account types' setting set to the 'Any Azure AD directory Multi tenant' option and also highlights the 'Unauthenticated requests' setting set to the 'HTTP 401 Unauthorized recommended for APIs' option." lightbox="media/spring-cloud-tutorial-managed-identities-functions/identity-provider-settings.png":::
84+
:::image type="content" source="media/tutorial-managed-identities-functions/identity-provider-settings.png" alt-text="Screenshot of the Azure portal showing the settings page for adding an identity provider. This page highlights the 'supported account types' setting set to the 'Any Azure AD directory Multi tenant' option and also highlights the 'Unauthenticated requests' setting set to the 'HTTP 401 Unauthorized recommended for APIs' option." lightbox="media/tutorial-managed-identities-functions/identity-provider-settings.png":::
8585

8686
1. Select **Add**.
8787

8888
After you add the settings, the Function app restarts and all subsequent requests are prompted to sign in through Azure AD. You can test that unauthenticated requests are currently being rejected with the Function app's root URL (returned in the `hostNames` output of the `az functionapp create` command). You should then be redirected to your organization's Azure Active Directory sign-in screen.
8989

90+
You need the Application ID and the Application ID URI for later use. In the Azure portal, navigate to the Function app you created.
91+
92+
To get the Application ID, select **Authentication** in the navigation pane, and then copy the **App (client) ID** value for the identity provider that includes the name of the Function app.
93+
94+
:::image type="content" source="media/tutorial-managed-identities-functions/function-authentication.png" alt-text="Screenshot of the Azure portal showing the Authentication page for a Function app, with the Function app name highlighted in the Identity provider." lightbox="media/tutorial-managed-identities-functions/function-authentication.png":::
95+
96+
To get the Application ID URI, select **Expose an API** in the navigation pane, and then copy the **Application ID URI** value.
97+
98+
:::image type="content" source="media/tutorial-managed-identities-functions/function-expose-api.png" alt-text="Screenshot of the Azure portal showing the Expose an API page for a Function app with the Application ID URI highlighted." lightbox="media/tutorial-managed-identities-functions/function-expose-api.png":::
99+
90100
## Create an HTTP triggered function
91101

92102
In an empty local directory, use the following commands to create a new function app and add an HTTP triggered function.
@@ -173,6 +183,7 @@ This sample invokes the HTTP triggered function by first requesting an access to
173183
```text
174184
azure.function.uri=https://<function-app-name>.azurewebsites.net
175185
azure.function.triggerPath=httptrigger
186+
azure.function.application-id.uri=<function-app-application-ID-uri>
176187
```
177188

178189
1. Use the following command to package your sample app.

0 commit comments

Comments
 (0)