Skip to content

Commit 14d0a6d

Browse files
authored
Merge pull request #285807 from Clare-Zheng82/0829-Add_Rest_SP_Cert
[New feature] Add SP cert auth content and TSG for REST
2 parents 29c5f71 + ffca284 commit 14d0a6d

File tree

5 files changed

+70
-4
lines changed

5 files changed

+70
-4
lines changed

articles/data-factory/connector-rest.md

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: jianleishen
66
ms.subservice: data-movement
77
ms.custom: synapse
88
ms.topic: conceptual
9-
ms.date: 02/26/2024
9+
ms.date: 08/29/2024
1010
ms.author: makromer
1111
---
1212

@@ -140,12 +140,18 @@ Set the **authenticationType** property to **AadServicePrincipal**. In addition
140140
| Property | Description | Required |
141141
|:--- |:--- |:--- |
142142
| servicePrincipalId | Specify the Microsoft Entra application's client ID. | Yes |
143-
| servicePrincipalKey | Specify the Microsoft Entra application's key. Mark this field as a **SecureString** to store it securely in Data Factory, or [reference a secret stored in Azure Key Vault](store-credentials-in-key-vault.md). | Yes |
143+
| servicePrincipalCredentialType | Specify the credential type to use for service principal authentication. Allowed values are `ServicePrincipalKey` and `ServicePrincipalCert`. | No |
144+
| ***For ServicePrincipalKey*** | | |
145+
| servicePrincipalKey | Specify the Microsoft Entra application's key. Mark this field as a **SecureString** to store it securely in Data Factory, or [reference a secret stored in Azure Key Vault](store-credentials-in-key-vault.md). | No |
146+
| ***For ServicePrincipalCert*** | | |
147+
| servicePrincipalEmbeddedCert | Specify the base64 encoded certificate of your application registered in Microsoft Entra ID, and ensure the certificate content type is **PKCS #12**. Mark this field as a **SecureString** to store it securely, or [reference a secret stored in Azure Key Vault](store-credentials-in-key-vault.md). Go to this [section](#save-the-service-principal-certificate-in-azure-key-vault) to learn how to save the certificate in Azure Key Vault. | No |
148+
| servicePrincipalEmbeddedCertPassword | Specify the password of your certificate if your certificate is secured with a password. Mark this field as a **SecureString** to store it securely, or [reference a secret stored in Azure Key Vault](store-credentials-in-key-vault.md). | No |
149+
| | | |
144150
| tenant | Specify the tenant information (domain name or tenant ID) under which your application resides. Retrieve it by hovering the mouse in the top-right corner of the Azure portal. | Yes |
145151
| aadResourceId | Specify the Microsoft Entra resource you are requesting for authorization, for example, `https://management.core.windows.net`.| Yes |
146152
| azureCloudType | For Service Principal authentication, specify the type of Azure cloud environment to which your Microsoft Entra application is registered. <br/> Allowed values are **AzurePublic**, **AzureChina**, **AzureUsGovernment**, and **AzureGermany**. By default, the data factory's cloud environment is used. | No |
147153

148-
**Example**
154+
**Example 1: Using service principal key authentication**
149155

150156
```json
151157
{
@@ -156,6 +162,7 @@ Set the **authenticationType** property to **AadServicePrincipal**. In addition
156162
"url": "<REST endpoint e.g. https://www.example.com/>",
157163
"authenticationType": "AadServicePrincipal",
158164
"servicePrincipalId": "<service principal id>",
165+
"servicePrincipalCredentialType": "ServicePrincipalKey",
159166
"servicePrincipalKey": {
160167
"value": "<service principal key>",
161168
"type": "SecureString"
@@ -170,6 +177,59 @@ Set the **authenticationType** property to **AadServicePrincipal**. In addition
170177
}
171178
}
172179
```
180+
181+
**Example 2: Using service principal certificate authentication**
182+
183+
```json
184+
{
185+
"name": "RESTLinkedService",
186+
"properties": {
187+
"type": "RestService",
188+
"typeProperties": {
189+
"url": "<REST endpoint e.g. https://www.example.com/>",
190+
"authenticationType": "AadServicePrincipal",
191+
"servicePrincipalId": "<service principal id>",
192+
"servicePrincipalCredentialType": "ServicePrincipalCert",
193+
"servicePrincipalEmbeddedCert": {
194+
"type": "SecureString",
195+
"value": "<the base64 encoded certificate of your application registered in Microsoft Entra ID>"
196+
},
197+
"servicePrincipalEmbeddedCertPassword": {
198+
"type": "SecureString",
199+
"value": "<password of your certificate>"
200+
},
201+
"tenant": "<tenant info, e.g. microsoft.onmicrosoft.com>",
202+
"aadResourceId": "<Azure AD resource URL e.g. https://management.core.windows.net>"
203+
},
204+
"connectVia": {
205+
"referenceName": "<name of Integration Runtime>",
206+
"type": "IntegrationRuntimeReference"
207+
}
208+
}
209+
}
210+
```
211+
212+
#### Save the service principal certificate in Azure Key Vault
213+
214+
You have two options to save the service principal certificate in Azure Key Vault:
215+
216+
- **Option 1**
217+
218+
1. Convert the service principal certificate to a base64 string. Learn more from this [article](https://blog.tekspace.io/convert-certificate-from-pfx-to-base64-with-powershell/).
219+
220+
221+
2. Save the base64 string as a secret in Azure Key Vault.
222+
223+
:::image type="content" source="media/connector-rest/secrets.png" alt-text="Screenshot of secrets.":::
224+
225+
:::image type="content" source="media/connector-rest/secret-value.png" alt-text="Screenshot of secret value.":::
226+
227+
- **Option 2**
228+
229+
If you can't download the certificate from Azure Key Vault, you can use this [template](https://supportability.visualstudio.com/256c8350-cb4b-49c9-ac6e-a012aeb312d1/_apis/git/repositories/da6cf5d9-0dc5-4ba9-a5e2-6e6a93adf93c/Items?path=/AzureDataFactory/.attachments/ConvertCertToBase64StringInAKVPipeline-47f8e507-e7ef-4343-a73b-733b9a7f8e4e.zip&download=false&resolveLfs=true&%24format=octetStream&api-version=5.0-preview.1&sanitize=true&includeContentMetadata=true&versionDescriptor.version=master) to save the converted service principal certificate as a secret in Azure Key Vault.
230+
231+
:::image type="content" source="media/connector-rest/template-pipeline.png" alt-text="Screenshot of template pipeline to save service principal certificate as a secret in AKV.":::
232+
173233
### Use OAuth2 Client Credential authentication
174234

175235
Set the **authenticationType** property to **OAuth2ClientCredential**. In addition to the generic properties that are described in the preceding section, specify the following properties:

articles/data-factory/connector-troubleshoot-rest.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to troubleshoot issues with the REST connector in Azure D
55
author: jianleishen
66
ms.subservice: data-movement
77
ms.topic: troubleshooting
8-
ms.date: 10/20/2023
8+
ms.date: 08/29/2024
99
ms.author: jianleishen
1010
ms.custom: has-adal-ref, synapse
1111
---
@@ -59,6 +59,12 @@ This article provides suggestions to troubleshoot common problems with the REST
5959

6060
Tools like **Fiddler** are recommended for the preceding case.
6161

62+
## The service principal certificate in Azure Key Vault is not correct
63+
64+
- **Message**: `"Failed to create certificate from certificate raw data and password. Cannot find the requested object."`
65+
- **Cause**: Only support the base64 string service principal certificate for Rest connector service principal certificate authentication.
66+
- **Recommendation**: Follow this [section](connector-rest.md#save-the-service-principal-certificate-in-azure-key-vault) to save the service principal certificate in Azure Key Vault correctly.
67+
6268
## Related content
6369

6470
For more troubleshooting help, try these resources:
40.8 KB
Loading
8.96 KB
Loading
35.1 KB
Loading

0 commit comments

Comments
 (0)