Skip to content

Commit 8226266

Browse files
Merge pull request #234539 from HeidiSteen/heidist-refresh
[azure search] MattG addition for RBAC doc, "Test as current user"
2 parents f17a07c + 72a6703 commit 8226266

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

articles/search/search-security-rbac.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ author: HeidiSteen
88
ms.author: heidist
99
ms.service: cognitive-search
1010
ms.topic: how-to
11-
ms.date: 01/26/2023
11+
ms.date: 04/14/2023
1212
ms.custom: subject-rbac-steps, references_regions
1313
---
1414

@@ -331,6 +331,41 @@ More details about using [Azure AD authentication with the Azure SDK for .NET](h
331331
332332
---
333333

334+
## Test as current user
335+
336+
If you're already a Contributor or Owner of your search service, you can present a bearer token for your user identity for authentication to Azure Cognitive Search. The following instructions explain how to set up a Postman collection to send requests as the current user.
337+
338+
1. Get a bearer token for the current user:
339+
340+
```azurecli
341+
az account get-access-token https://search.azure.com/.default
342+
```
343+
344+
1. Start a new Postman collection and edit its properties. In the **Variables** tab, create the following variable:
345+
346+
| Variable | Description |
347+
|----------|-------------|
348+
| bearerToken | (copy-paste from get-access-token output on the command line) |
349+
350+
1. In the Authorization tab, select **Bearer Token** as the type.
351+
352+
1. In the **Token** field, specify the variable placeholder `{{bearerToken}}`.
353+
354+
1. Save the collection.
355+
356+
1. Send a request to confirm access. Here's one that queries the hotels-quickstart index:
357+
358+
```http
359+
POST https://<service-name>.search.windows.net/indexes/hotels-quickstart/docs/search?api-version=2020-06-30
360+
{
361+
"queryType": "simple",
362+
"search": "motel",
363+
"filter": "",
364+
"select": "HotelName,Description,Category,Tags",
365+
"count": true
366+
}
367+
```
368+
334369
<a name="rbac-single-index"></a>
335370

336371
## Grant access to a single index

0 commit comments

Comments
 (0)