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
Copy file name to clipboardExpand all lines: docs/login_and_acl.md
+63-9Lines changed: 63 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,14 +59,68 @@ Two Microsoft Entra applications must be registered in order to make the optiona
59
59
60
60
The easiest way to setup the two apps is to use the `azd` CLI. We've written scripts that will automatically create the two apps and configure them for use with the sample. To trigger the automatic setup, run the following commands:
61
61
62
-
1. Run `azd env set AZURE_USE_AUTHENTICATION true` to enable the login UI and use App Service authentication by default.
63
-
1. Ensure access control is enabled on your search index. If your index doesn't exist yet, run prepdocs with `AZURE_USE_AUTHENTICATION` set to `true`. If your index already exists, run `python ./scripts/manageacl.py --acl-action enable_acls`.
64
-
1. (Optional) To require access control when using the app, run `azd env set AZURE_ENFORCE_ACCESS_CONTROL true`. Authentication is always required to search on documents with access control assigned, regardless of if unauthenticated access is enabled or not.
65
-
1. (Optional) To allow authenticated users to search on documents that have no access controls assigned, even when access control is required, run `azd env set AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS true`.
66
-
1. (Optional) To allow unauthenticated users to use the app, even when access control is enforced, run `azd env set AZURE_ENABLE_UNAUTHENTICATED_ACCESS true`. `AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS` should also be set to true if you want unauthenticated users to be able to search on documents with no access control.
67
-
1. Run `azd env set AZURE_AUTH_TENANT_ID <YOUR-TENANT-ID>` to set the tenant ID associated with authentication.
68
-
1. If your auth tenant ID is different from your currently logged in tenant ID, run `azd auth login --tenant-id <YOUR-TENANT-ID>` to login to the authentication tenant simultaneously.
69
-
1. Run `azd up` to deploy the app.
62
+
1.**Enable authentication for the app**
63
+
Run the following command to show the login UI and use Entra authentication by default:
To ensure that the app restricts search results to only documents that the user has access to, run the following command:
83
+
84
+
```shell
85
+
azd env set AZURE_ENFORCE_ACCESS_CONTROL true
86
+
```
87
+
88
+
1. (Optional) **Allow global document access**
89
+
To allow users to search on documents that have no access controls assigned, even when access control is required, run the following command:
90
+
91
+
```shell
92
+
azd env set AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS true
93
+
```
94
+
95
+
1. (Optional) **Allow unauthenticated access**
96
+
To allow unauthenticated users to use the app, even when access control is enforced, run the following command:
97
+
98
+
```shell
99
+
azd env set AZURE_ENABLE_UNAUTHENTICATED_ACCESS true
100
+
```
101
+
102
+
Note: These users will not be able to search on documents that have access control assigned, so `AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS` should also be set to true to give them access to the remaining documents.
103
+
104
+
1. **Set the authentication tenant ID**
105
+
Specify the tenant ID associated with authentication by running:
106
+
107
+
```shell
108
+
azd env set AZURE_AUTH_TENANT_ID <YOUR-TENANT-ID>
109
+
```
110
+
111
+
1. **Login to the authentication tenant (if needed)**
112
+
If your auth tenant ID is different from your currently logged in tenant ID, run:
113
+
114
+
```shell
115
+
azd auth login --tenant-id <YOUR-TENANT-ID>
116
+
```
117
+
118
+
1. **Deploy the app**
119
+
Finally, run the following command to provision and deploy the app:
120
+
121
+
```shell
122
+
azd up
123
+
```
70
124
71
125
### Manual Setup
72
126
@@ -221,7 +275,7 @@ The script supports the following commands. All commands support `-v` for verbos
221
275
python ./scripts/manageacl.py -v --acl-type groups --acl-action view --url https://st12345.blob.core.windows.net/content/Benefit_Options.pdf
222
276
```
223
277
224
-
-`python ./scripts/manageacl.py --acl-type [oids or groups]--acl-action add --acl [ID of group or user] --url [https://url.pdf]`: Adds an access control value associated with either User IDs or Group IDs for the document at the specified URL.
278
+
- `python ./scripts/manageacl.py --acl-type [oids or groups]--acl-action add --acl [ID of group or user] --url [https://url.pdf]`: Adds an access control value associated with either User IDs or Group IDs for the document at the specified URL.
if ($AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS-eq"true") {
9
+
if ($AZURE_ENFORCE_ACCESS_CONTROL-ne"true") {
10
+
Write-Host"AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS is set to true, but AZURE_ENFORCE_ACCESS_CONTROL is not set to true. Please set it and retry."
11
+
Exit1
12
+
}
13
+
}
14
+
15
+
if ($USE_CHAT_HISTORY_COSMOS-eq"true") {
16
+
if ($AZURE_USE_AUTHENTICATION-ne"true") {
17
+
Write-Host"AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS, AZURE_ENFORCE_ACCESS_CONTROL, or USE_CHAT_HISTORY_COSMOS is set to true, but AZURE_USE_AUTHENTICATION is not set to true. Please set and retry."
18
+
Exit1
19
+
}
20
+
}
21
+
4
22
if ($AZURE_USE_AUTHENTICATION-ne"true") {
5
23
Write-Host"AZURE_USE_AUTHENTICATION is not set, skipping authentication setup."
0 commit comments