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
# Customer intent: As a tenant administrator, I want to make sure that I protect my API endpoint with proper authentication.
15
17
---
16
18
17
19
# Secure your API used an API connector in Azure AD External Identities self-service sign-up user flows
18
20
19
-
When integrating a REST API within an Azure AD external identities self-service sign-up user flow, you must protect your REST API endpoint with authentication. The REST API authentication ensures that only services that have proper credentials, such as Azure AD, can make calls to your endpoint. This article will explore how to secure REST API.
21
+
When integrating a REST API within an Azure AD external identities self-service sign-up user flow, you must protect your REST API endpoint with authentication. The REST API authentication ensures that only services that have proper credentials, such as Azure AD, can make calls to your endpoint. This article explores how to secure REST API.
20
22
21
23
## Prerequisites
22
24
Complete the steps in the [Walkthrough: Add an API connector to a sign-up user flow](self-service-sign-up-add-api-connector.md) guide.
23
25
24
-
You can protect your API endpoint by using either HTTP basic authentication or HTTPS client certificate authentication. In either case, you provide the credentials that Azure AD will use when calling your API endpoint. Your API endpoint then checks the credentials and performs authorization decisions.
25
-
26
+
You can protect your API endpoint by using either HTTP basic authentication or HTTPS client certificate authentication. In either case, you provide the credentials that Azure AD uses when calling your API endpoint. Your API endpoint then checks the credentials and performs authorization decisions.
26
27
27
28
## HTTP basic authentication
28
29
@@ -32,11 +33,12 @@ To configure an API Connector with HTTP basic authentication, follow these steps
32
33
33
34
1. Sign in to the [Azure portal](https://portal.azure.com/).
34
35
2. Under **Azure services**, select **Azure AD**.
35
-
3. Select **API connectors**, and then select the **API Connector** you want to configure.
36
-
4. For the **Authentication type**, select **Basic**.
37
-
5. Provide the **Username**, and **Password** of your REST API endpoint.
38
-
:::image type="content" source="media/secure-api-connector/api-connector-config.png" alt-text="Providing basic authentication configuration for an API connector.":::
39
-
6. Select **Save**.
36
+
1. In the left menu, select **External Identities**.
37
+
1. Select **All API connectors**, and then select the **API Connector** you want to configure.
38
+
1. For the **Authentication type**, select **Basic**.
39
+
1. Provide the **Username**, and **Password** of your REST API endpoint.
40
+
:::image type="content" source="media/secure-api-connector/api-connector-config.png" alt-text="Screenshot of basic authentication configuration for an API connector.":::
41
+
1. Select **Save**.
40
42
41
43
## HTTPS client certificate authentication
42
44
@@ -69,29 +71,30 @@ To configure an API Connector with client certificate authentication, follow the
69
71
70
72
1. Sign in to the [Azure portal](https://portal.azure.com/).
71
73
2. Under **Azure services**, select **Azure AD**.
72
-
3. Select **API connectors**, and then select the **API Connector** you want to configure.
73
-
4. For the **Authentication type**, select **Certificate**.
74
-
5. In the **Upload certificate** box, select your certificate's .pfx file with a private key.
75
-
6. In the **Enter Password** box, type the certificate's password.
76
-
:::image type="content" source="media/secure-api-connector/api-connector-upload-cert.png" alt-text="Providing certificate authentication configuration for an API connector.":::
77
-
7. Select **Save**.
74
+
1. In the left menu, select **External Identities**.
75
+
1. Select **All API connectors**, and then select the **API Connector** you want to configure.
76
+
1. For the **Authentication type**, select **Certificate**.
77
+
1. In the **Upload certificate** box, select your certificate's .pfx file with a private key.
78
+
1. In the **Enter Password** box, type the certificate's password.
79
+
:::image type="content" source="media/secure-api-connector/api-connector-upload-cert.png" alt-text="Screenshot of certificate authentication configuration for an API connector.":::
80
+
1. Select **Save**.
78
81
79
82
### Perform authorization decisions
80
83
Your API must implement the authorization based on sent client certificates in order to protect the API endpoints. For Azure App Service and Azure Functions, see [configure TLS mutual authentication](../../app-service/app-service-web-configure-tls-mutual-auth.md) to learn how to enable and *validate the certificate from your API code*. You can alternatively use Azure API Management as a layer in front of any API service to [check client certificate properties](
81
84
../../api-management/api-management-howto-mutual-certificates-for-clients.md) against desired values.
82
85
83
86
### Renewing certificates
84
-
It's recommended you set reminder alerts for when your certificate will expire. You will need to generate a new certificate and repeat the steps above when used certificates are about to expire. To "roll" the use of a new certificate, your API service can continue to accept old and new certificates for a temporary amount of time while the new certificate is deployed.
87
+
It's recommended you set reminder alerts for when your certificate expires. You'll need to generate a new certificate and repeat the steps above when used certificates are about to expire. To "roll" the use of a new certificate, your API service can continue to accept old and new certificates for a temporary amount of time while the new certificate is deployed.
85
88
86
-
To upload a new certificate to an existing API connector, select the API connector under **API connectors** and click on **Upload new certificate**. The most recently uploaded certificate which is not expired and whose start date has passed will automatically be used by Azure AD.
89
+
To upload a new certificate to an existing API connector, select the API connector under **API connectors** and select on **Upload new certificate**. The most recently uploaded certificate that isn't expired and whose start date has passed will automatically be used by Azure AD.
87
90
88
-
:::image type="content" source="media/secure-api-connector/api-connector-renew-cert.png" alt-text="Providing a new certificate to an API connector when one already exists.":::
91
+
:::image type="content" source="media/secure-api-connector/api-connector-renew-cert.png" alt-text="Screenshot of a new certificate, when one already exists.":::
89
92
90
93
## API key authentication
91
94
92
95
Some services use an "API key" mechanism to obfuscate access to your HTTP endpoints during development by requiring the caller to include a unique key as an HTTP header or HTTP query parameter. For [Azure Functions](../../azure-functions/functions-bindings-http-webhook-trigger.md#authorization-keys), you can accomplish this by including the `code` as a query parameter in the **Endpoint URL** of your API connector. For example, `https://contoso.azurewebsites.net/api/endpoint`<b>`?code=0123456789`</b>).
93
96
94
-
This is not a mechanism that should be used alone in production. Therefore, configuration for basic or certificate authentication is always required. If you do not wish to implement any authentication method (not recommended) for development purposes, you can select 'basic' authentication in the API connector configuration and use temporary values for `username` and `password` that your API can disregard while you implement proper authorization.
97
+
This isn't a mechanism that should be used alone in production. Therefore, configuration for basic or certificate authentication is always required. If you don't wish to implement any authentication method (not recommended) for development purposes, you can select 'basic' authentication in the API connector configuration and use temporary values for `username` and `password` that your API can disregard while you implement proper authorization.
95
98
96
99
## Next steps
97
100
- Get started with our [quickstart samples](code-samples-self-service-sign-up.md#api-connector-azure-function-quickstarts).
0 commit comments