Skip to content

Commit 24e4fca

Browse files
committed
Added instructions for resolving the LinkedAuthorizationFailed error
1 parent b09c39a commit 24e4fca

File tree

2 files changed

+67
-28
lines changed

2 files changed

+67
-28
lines changed

articles/search/search-indexer-howto-access-private.md

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.author: arjagann
99
ms.service: cognitive-search
1010
ms.custom: ignite-2022
1111
ms.topic: how-to
12-
ms.date: 02/14/2023
12+
ms.date: 02/22/2023
1313
---
1414

1515
# Make outbound connections through a private endpoint
@@ -54,6 +54,8 @@ When evaluating shared private links for your scenario, remember these constrain
5454

5555
+ An Azure PaaS resource from the following list of supported resource types, configured to run in a virtual network, with a private endpoint created through Azure Private Link.
5656

57+
+ You should have a minimum of Contributor permissions on both Cognitive Search and the Azure PaaS resource for which you're creating the shared private link.
58+
5759
<a name="group-ids"></a>
5860

5961
### Supported resource types
@@ -96,13 +98,17 @@ These Private Link tutorials provide steps for creating a private endpoint for A
9698

9799
## 1 - Create a shared private link
98100

99-
Use the Azure portal, Management REST API, the Azure CLI, or Azure PowerShell to create a shared private link. Remember to use the preview API version, either `2020-08-01-preview` or `2021-04-01-preview`, if you're using a group ID that's in preview. The following resource types are in preview and require a preview API: `managedInstance`, `mySqlServer`, `sites`.
101+
Use the Azure portal, Management REST API, the Azure CLI, or Azure PowerShell to create a shared private link.
102+
103+
Here are a few tips to keep in mind:
100104

101-
It's possible to create a shared private link for an Azure PaaS resource that doesn't have a private endpoint, but it won't work unless the [resource has a private endpoint](#private-endpoint-verification).
105+
+ Give the private link a meaningful name. In the Azure PaaS resource, a shared private link appears alongside other private endpoints. Assigning a name like "shared-private-link-for-search" will help you remember how the link is used.
102106

103-
Recall that you can't use the portal or the Azure CLI `az search` command to create a shared private link to an Azure SQL Managed Instance. See [Create a shared private link for SQL Managed Instance](#create-a-shared-private-link-for-a-sql-managed-instance) for that resource type.
107+
+ Don't skip the [private link verification](#private-endpoint-verification) step. It's possible to create a shared private link for an Azure PaaS resource that doesn't have a private endpoint, but it won't work unless the resource is registered.
104108

105-
When you complete these steps, you have a shared private link that's provisioned in a pending state. The resource owner needs to approve the request before it's operational.
109+
+ SQL managed instance has extra requirements for creating a private link. Currently, you can't use the portal or the Azure CLI `az search` command because neither approach formulates a valid URI. Instead, follow the instructions in [Create a shared private link for SQL Managed Instance](#create-a-shared-private-link-for-a-sql-managed-instance) in this article for a workaround.
110+
111+
When you complete these steps, you have a shared private link that's provisioned in a pending state. **It takes several minutes to create the link**. Once it's created, the resource owner needs to approve the request before it's operational.
106112

107113
### [**Azure portal**](#tab/portal-create)
108114

@@ -132,33 +138,65 @@ When you complete these steps, you have a shared private link that's provisioned
132138

133139
### [**REST API**](#tab/rest-create)
134140

135-
See [Manage with REST](search-manage-rest.md) for instructions on setting up a REST client for issuing Management REST API requests.
141+
Other tools like the portal, Azure PowerShell, or the Azure CLI have built-in mechanisms for account sign in. If you're using a REST client, such as Postman, you'll need to provide a bearer token that allows your request to go through. Because it's easy and quick, this section uses Azure CLI steps for getting a bearer token. For other approaches, see [Manage with REST](search-manage-rest.md).
136142

137-
First, use [Get](/rest/api/searchmanagement/2020-08-01/shared-private-link-resources/get) to review any existing shared private links to ensure you're not duplicating a link. There can be only one shared private link for each resource and sub-resource combination.
143+
> [!NOTE]
144+
> Remember to use the preview API version, either `2020-08-01-preview` or `2021-04-01-preview`, if you're using a group ID that's in preview. The following resource types are in preview and require a preview Management REST API: `managedInstance`, `mySqlServer`, `sites`. Remember to use the instructions in [create a shared private link for SQL Managed Instance](#create-a-shared-private-link-for-a-sql-managed-instance) for that resource type.
138145
139-
```http
140-
GET https://https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{rg-name}}/providers/Microsoft.Search/searchServices/{{service-name}}/sharedPrivateLinkResources?api-version={{api-version}}
141-
```
146+
1. Open a command line and run `az login` for Azure sign in.
142147

143-
Use [Create or Update](/rest/api/searchmanagement/2020-08-01/shared-private-link-resources/create-or-update) for the next step, providing the name of the link name on the URI, and the target Azure resource in the body of the request. The following example is for blob storage.
148+
1. Show the active account and subscription. Verify that this subscription is the same one that has the Azure PaaS resource for which you're creating the shared private link.
144149

145-
```http
146-
PUT https://https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{rg-name}}/providers/Microsoft.Search/searchServices/{{service-name}}/sharedPrivateLinkResources/{{shared-private-link-name}}?api-version={{api-version}}
147-
{
148-
"properties":
149-
{
150-
"groupID": "blob",
151-
"privateLinkResourceId": "/subscriptions/{{subscriptionId}}/resourceGroups/{{rg-name}}/providers/Microsoft.Storage/storageAccounts/{{storage-account-name}}",
152-
"provisioningState": "",
153-
"requestMessage": "Please approve this request.",
154-
"resourceRegion": "",
155-
"status": ""
156-
}
157-
}
150+
```azurecli
151+
az account show
152+
```
158153

159-
```
154+
1. Create a bearer token, and then copy the entire token (everything between the quotation marks).
160155

161-
Rerun the first request to monitor the provisioning state as it transitions from updating to succeeded.
156+
```azurecli
157+
az account get-access-token
158+
```
159+
160+
1. Switch to a REST client and set up a [GET Shared Private Link Resource](/rest/api/searchmanagement/2020-08-01/shared-private-link-resources/get). This step allows you to review existing shared private links to ensure you're not duplicating a link. There can be only one shared private link for each resource and sub-resource combination.
161+
162+
```http
163+
GET https://https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{rg-name}}/providers/Microsoft.Search/searchServices/{{service-name}}/sharedPrivateLinkResources?api-version={{api-version}}
164+
```
165+
166+
1. On the **Authorization** tab, select **Bearer Token** and then paste in the token.
167+
168+
1. Set the content type to JSON.
169+
170+
1. Send the request. You should get a list of all shared private link resources that exist for your search service.
171+
172+
1. Formulate a PUT request to [Create or Update Shared Private Link](/rest/api/searchmanagement/2020-08-01/shared-private-link-resources/create-or-update) for the Azure PaaS resource. Provide a URI and request body similar to the following example:
173+
174+
```http
175+
PUT https://https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{rg-name}}/providers/Microsoft.Search/searchServices/{{service-name}}/sharedPrivateLinkResources/{{shared-private-link-name}}?api-version={{api-version}}
176+
{
177+
"properties":
178+
{
179+
"groupID": "blob",
180+
"privateLinkResourceId": "/subscriptions/{{subscriptionId}}/resourceGroups/{{rg-name}}/providers/Microsoft.Storage/storageAccounts/{{storage-account-name}}",
181+
"provisioningState": "",
182+
"requestMessage": "Please approve this request.",
183+
"resourceRegion": "",
184+
"status": ""
185+
}
186+
}
187+
```
188+
189+
1. As before, provide the bearer token and make sure the content type is JSON.
190+
191+
If the Azure PaaS resource is in a different subscription, use the Azure CLI to change the subscription, and then get a bearer token that is valid for that subscription:
192+
193+
```azurecli
194+
az account set --subscription {{Azure PaaS subscription ID}}
195+
196+
az account get-access-token
197+
```
198+
199+
1. To check the status, rerun the first GET Shared Private Link request to monitor the provisioning state as it transitions from updating to succeeded.
162200

163201
### [**PowerShell**](#tab/ps-create)
164202

articles/search/troubleshoot-shared-private-link-resources.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.author: arjagann
99
ms.service: cognitive-search
1010
ms.custom: ignite-2022
1111
ms.topic: conceptual
12-
ms.date: 01/18/2023
12+
ms.date: 02/22/2023
1313
---
1414

1515
# Troubleshoot issues with Shared Private Links in Azure Cognitive Search
@@ -69,7 +69,8 @@ A search service initiates the request to create a shared private link, but Azur
6969
Shared private link resources that have failed Azure Resource Manager deployment will show up in [List](/rest/api/searchmanagement/2021-04-01-preview/shared-private-link-resources/list-by-service) and [Get](/rest/api/searchmanagement/2021-04-01-preview/shared-private-link-resources/get) API calls, but will have a "Provisioning State" of `Failed`. Once the reason of the Azure Resource Manager deployment failure has been ascertained, delete the `Failed` resource and re-create it after applying the appropriate resolution from the following table.
7070

7171
| Deployment failure reason | Description | Resolution |
72-
| --- | --- | --- |
72+
| ------------------------- | ----------- | ---------- |
73+
| Error code"LinkedAuthorizationFailed" | An error message states that the client has permission to create the shared private link on the search service, but does not have permission to perform action 'privateEndpointConnectionApproval/action' on the linked scope. | Re-check the private link ID in the request to make sure there are no errors or omissions in the URI. If Azure Cognitive Search and the Azure PaaS resource are in different subscriptions, and if you're using REST or a command line interface, make sure that the [active Azure account is for the Azure PaaS resource](search-indexer-howto-access-private.md#rest-api). For REST clients, make sure you're not using an expired bearer token, and that the token is valid for the active subscription. |
7374
| Network resource provider not registered on target resource's subscription | A private endpoint (and associated DNS mappings) is created for the target resource (Storage Account, Azure Cosmos DB, Azure SQL) via the `Microsoft.Network` resource provider (RP). If the subscription that hosts the target resource ("target subscription") isn't registered with `Microsoft.Network` RP, then the Azure Resource Manager deployment can fail. | You need to register this RP in their target subscription. You can [register the resource provider](/azure/azure-resource-manager/management/resource-providers-and-types#register-resource-provider) using the Azure portal, PowerShell, or CLI.|
7475
| Invalid `groupId` for the target resource | When Azure Cosmos DB accounts are created, you can specify the API type for the database account. While Azure Cosmos DB offers several different API types, Azure Cognitive Search only supports "Sql" as the `groupId` for shared private link resources. When a shared private link of type "Sql" is created for a `privateLinkResourceId` pointing to a non-Sql database account, the Azure Resource Manager deployment will fail because of the `groupId` mismatch. The Azure resource ID of an Azure Cosmos DB account isn't sufficient to determine the API type that is being used. Azure Cognitive Search tries to create the private endpoint, which is then denied by Azure Cosmos DB. | You should ensure that the `privateLinkResourceId` of the specified Azure Cosmos DB resource is for a database account of "Sql" API type |
7576
| Target resource not found | Existence of the target resource specified in `privateLinkResourceId` is checked only during the commencement of the Azure Resource Manager deployment. If the target resource is no longer available, then the deployment will fail. | You should ensure that the target resource is present in the specified subscription and resource group and isn't moved or deleted. |

0 commit comments

Comments
 (0)