Skip to content

Commit d25f167

Browse files
committed
Updates to document permission quickstarts
1 parent 93ad929 commit d25f167

File tree

4 files changed

+31
-14
lines changed

4 files changed

+31
-14
lines changed

Quickstart-Document-Permissions-Pull-API/document-permissions-pull-api.ipynb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
"\n",
2727
"## Permissions\n",
2828
"\n",
29+
"This walkthrough uses Microsoft Entra ID authentication and authorization.\n",
30+
"\n",
2931
"+ On Azure Storage, **Storage Blob Data Reader** permissions are required for both the search service identity and for your user account since you are testing locally. You also need **Storage Blob Data Contributor** because the sample includes code for creating and configuring a container and its contents.\n",
3032
"\n",
3133
"+ On Azure AI Search, assign yourself **Search Service Contributor**, **Search Index Data Contributor**, and **Search Index Data Reader** permissions to create objects and run queries. For more information, see [Connect to Azure AI Search using roles](https://learn.microsoft.com/azure/search/search-security-rbac) and [Quickstart: Connect without keys for local testing](https://learn.microsoft.com/azure/search/search-get-started-rbac).\n",
@@ -42,14 +44,17 @@
4244
"source": [
4345
"## Set up connections\n",
4446
"\n",
45-
"Save the `sample.env` file as `.env` and then modify the environment variables to use your Azure endpoints. You need endpoints for:\n",
47+
"Save the `sample.env` file as `.env` and then modify the environment variables to use your Azure endpoints. All variables must be specified.\n",
48+
"\n",
49+
"You need endpoints for:\n",
4650
"\n",
4751
"+ Azure AI Search\n",
4852
"+ Azure Storage\n",
4953
"\n",
5054
"For Azure AI Search, find the endpoint in the [Azure portal](https://portal.azure.com), in the **Essentials** section of the Overview page.\n",
5155
"\n",
52-
"For Azure Storage, follow the guidance in [Get storage account configuration information](https://learn.microsoft.com/azure/storage/common/storage-account-get-info).\n",
56+
"For Azure Storage, follow the guidance in [Get storage account configuration information](https://learn.microsoft.com/azure/storage/common/storage-account-get-info) to specify all of the variables in the `.env` file. \n",
57+
"\n",
5358
"\n",
5459
"## Load Connections\n",
5560
"\n",
@@ -91,9 +96,7 @@
9196
"source": [
9297
"## Create an index\n",
9398
"\n",
94-
"The search index must include fields for your content and for permission metadata. Assign the new permission filter option to a string field and make sure the field is filterable. The search engine builds the filter internally at query time.\n",
95-
"\n",
96-
"For local testing, `retrievable` should be **true** so that you can view the permission metadata, but be sure to change it back to **false** if you make the solution available to others."
99+
"The search index must include fields for your content and for permission metadata. Assign the new permission filter option to a string field and make sure the field is filterable. The search engine builds the filter internally at query time."
97100
]
98101
},
99102
{
@@ -112,8 +115,8 @@
112115
" fields=[\n",
113116
" SearchField(name=\"id\", type=\"Edm.String\", key=True, filterable=True, sortable=True),\n",
114117
" SearchField(name=\"content\", type=\"Edm.String\", searchable=True, filterable=False, sortable=False),\n",
115-
" SearchField(name=\"oids\", type=\"Collection(Edm.String)\", filterable=True, retrievable=True, permission_filter=PermissionFilter.USER_IDS),\n",
116-
" SearchField(name=\"groups\", type=\"Collection(Edm.String)\", filterable=True, retrievable=True, permission_filter=PermissionFilter.GROUP_IDS),\n",
118+
" SearchField(name=\"oids\", type=\"Collection(Edm.String)\", filterable=True, permission_filter=PermissionFilter.USER_IDS),\n",
119+
" SearchField(name=\"groups\", type=\"Collection(Edm.String)\", filterable=True, permission_filter=PermissionFilter.GROUP_IDS),\n",
117120
" SearchField(name=\"metadata_storage_path\", type=\"Edm.String\", searchable=True),\n",
118121
" SearchField(name=\"metadata_storage_name\", type=\"Edm.String\", searchable=True)\n",
119122
" ],\n",

Quickstart-Document-Permissions-Pull-API/sample.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ AZURE_SEARCH_INDEX=document-permissions-indexer-idx
33
AZURE_SEARCH_INDEXER=document-permissions-indexer-idxr
44
AZURE_SEARCH_DATASOURCE=document-permissions-indexer-ds
55
AZURE_STORAGE_ACCOUNT_NAME=
6-
AZURE_STORAGE_CONTAINER_NAME=
6+
AZURE_STORAGE_CONTAINER_NAME=state-parks
77
AZURE_STORAGE_CONNECTION_STRING=
88
AZURE_STORAGE_RESOURCE_ID=

Quickstart-Document-Permissions-Push-API/document-permissions-push-api.ipynb

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@
2121
"id": "b6585426",
2222
"metadata": {},
2323
"source": [
24+
"## Prerequisites\n",
25+
"\n",
26+
"+ Azure AI Search, with [role-based access control](https://learn.microsoft.com/azure/search/search-security-enable-roles).\n",
27+
"\n",
28+
"## Permissions\n",
29+
"\n",
30+
"This walkthrough uses Microsoft Entra ID authentication and authorization.\n",
31+
"\n",
32+
"On Azure AI Search, you must have role assignments to create objects and run queries:\n",
33+
"\n",
34+
"+ **Search Service Contributor**\n",
35+
"+ **Search Index Data Contributor**\n",
36+
"+ **Search Index Data Reader**\n",
37+
"\n",
38+
"For more information, see [Connect to Azure AI Search using roles](https://learn.microsoft.com/azure/search/search-security-rbac) and [Quickstart: Connect without keys for local testing](https://learn.microsoft.com/azure/search/search-get-started-rbac).\n",
39+
"\n",
2440
"## Set the environment variables\n",
2541
"\n",
2642
"1. Rename `sample.env` to `.env`.\n",
@@ -48,9 +64,9 @@
4864
"load_dotenv(override=True) # take environment variables from .env.\n",
4965
"\n",
5066
"# The following variables from your .env file are used in this notebook\n",
51-
"endpoint = os.environ[\"AZURE_SEARCH_ENDPOINT\", \"\"]\n",
67+
"endpoint = os.environ[\"AZURE_SEARCH_ENDPOINT\"]\n",
5268
"credential = DefaultAzureCredential()\n",
53-
"index_name = os.getenv(\"AZURE_SEARCH_INDEX\", \"acl-sample\")\n",
69+
"index_name = os.getenv(\"AZURE_SEARCH_INDEX\")\n",
5470
"token_provider = get_bearer_token_provider(credential, \"https://search.azure.com/.default\")\n"
5571
]
5672
},
@@ -61,9 +77,7 @@
6177
"source": [
6278
"## Create Sample Index\n",
6379
"\n",
64-
"The search index must includes fields for your content and for permission metadata. Assign the new permission filter option to a string field and make sure the field is filterable. The search engine builds the filter internally at query time.\n",
65-
"\n",
66-
"For local testing, `retrievable` should be **true** so that you can view the permission metadata, but be sure to change it back to **false** if you make the solution available to others."
80+
"The search index must includes fields for your content and for permission metadata. Assign the new permission filter option to a string field and make sure the field is filterable. The search engine builds the filter internally at query time."
6781
]
6882
},
6983
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
AZURE_SEARCH_ENDPOINT=https://your-search-service.search.windows.net
2-
AZURE_SEARCH_INDEX=acl-sample
2+
AZURE_SEARCH_INDEX=document-permissions-push-idx

0 commit comments

Comments
 (0)