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/2-run-locally.md
+19-11
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,37 @@
1
1
# 👨🏻💻 Run Locally
2
2
3
-
Clone this repository locally or fork to your GitHub account. Run all of the the steps below from the `src` directory.
3
+
Clone this repository locally or fork to your GitHub account. Follow the steps below to run the solution locally:
4
4
5
5
## Prerequisites
6
6
7
-
-**History Database**: If you don't want to [provision the Azure resources](./4-deploy-to-azure.md), you **must** at least deploy an instance of Azure Cosmos DB in your Azure Subscription to store chat history.
7
+
Azure Chat is heavily dependant on a large number of Azure services. The easiest way to deploy all of these required services into an Azure subscription is to use the the [Azure Developer CLI](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/overview) as follows:
8
8
9
-
-**Identity Provider**: For local development, you have the option of using a username / password to sign in. If you prefer to use an Identity Provider, follow the [instructions](./3-add-identity.md) in the next chapter to add one.
9
+
1. Install the [Azure Developer CLI](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/overview)
10
+
1. From the root of the repository:
10
11
11
-
## Steps to Run Locally
12
+
1. Run `azd init`
13
+
1. Run `azd provision` to provision the Azure resources
14
+
15
+
16
+
## Identity Provider
17
+
18
+
For local development you can use the `Basic Auth (DEV ONLY)` provider to sign in - this local development identity provider will accept any user name and password, and the username you enter will create a new user id (hash of username@localhost) so you can simulate multiple users. If you prefer to use an Identity Provider (Entra ID or GitHub) for local development follow the [instructions](./3-add-identity.md) in the next chapter to add one.
19
+
20
+
## Run the App
21
+
22
+
With the prerequisites complete, follow the steps below to run the solution locally:
12
23
13
24
1. Change directory to the `src` folder
14
-
2. Rename/copy the file `.env.example` to `.env.local` and populate the environment variables based on the deployed resources in Azure.
25
+
2. Rename/copy the file `.env.example` to `.env` and populate the environment variables based on the deployed resources in Azure.
15
26
16
-
> **NOTE**
17
-
> If you have used the Azure Developer CLI to deploy the Azure infrastructure required for the solution ([using the directions here](./4-deploy-to-azure.md)), you can find the values for many the required environment variables in the `.env` file the `.azure\<azd env name>` directory. This generated file will not contain any keys, however it is recommended to use managed identities as described in "Setup your local development environment" on [this page](./9-managed-identities.md).
27
+
> **NOTE**
28
+
> If you have used the Azure Developer CLI to deploy the Azure services required for the solution (as described above), you can find the values for most the required environment variables in the `.env` file the `.azure\<azd env name>` directory. This generated file will not contain any keys, however it is recommended to use managed identities as described in "Run Locally with Managed Identities" on [this page](./9-managed-identities.md).
18
29
19
30
3. Install npm packages by running `npm install`
20
31
4. Start the app by running `npm run dev`
21
32
5. Access the app on [http://localhost:3000](http://localhost:3000)
22
33
23
-
You should now be prompted to log in with your chosen authentication method (per the pre-requisite configuration).
24
-
25
-
> **NOTE**
26
-
> If using Basic Auth (DEV ONLY), any username you enter will create a new user id (hash of username@localhost). You can use this to simulate multiple users. Once successfully logged in, you can start creating new conversations.
34
+
You should now be prompted to log in with your chosen authentication method (per your Identity Provider configuration), and you can start chatting.
Copy file name to clipboardexpand all lines: docs/9-managed-identities.md
+20-4
Original file line number
Diff line number
Diff line change
@@ -40,15 +40,31 @@ Using Managed Identities is preferred for production deployments due to:
40
40
41
41
### Deploy to Azure with Managed Identities
42
42
43
-
To deploy the application to Azure App Service with Managed Identities, follow the standard deployment instructions available in the [Deploy to Azure - GitHub Actions](https://github.com/microsoft/azurechat) section of the repository. Ensure to:
43
+
To deploy the application to Azure App Service with Managed Identities, follow the standard deployment instructions available in the [Deploy to Azure - GitHub Actions](https://github.com/microsoft/azurechat) section of the repository as follows:
44
44
45
45
1.**Update the Parameter**:
46
46
- Set the parameter `disableLocalAuth` to `true` in [`infra/main.bicep`](/infra/main.bicep) (or [`infra/main.json`](/infra/main.json) for ARM deployment) to use Managed Identities.
47
47
2.**Deploy resources using azd**:
48
48
- Refer to the [README](../README.md)
49
-
3.**(Optional) Setup your local development environment**:
49
+
50
+
## Run Locally with Managed Identities
50
51
51
-
Run this script to grant yourself RBAC permissions on the Azure resources so you can run AzureChat locally with managed identities.
52
+
You can run Azure Chat locally with Managed Identities - in this case the identity of the currently logged in user (via `az login`) is used to authenticate with the required Azure services. Follow the steps below to run Azure Chat locally with Managed Identities:
53
+
54
+
1. Refer to the documentation in [Run Locally](2-run-locally.md) to set up your local environment up for development.
55
+
1. Update your `.env` file with the following setting:
56
+
```
57
+
USE_MANAGED_IDENTITIES=true
58
+
```
59
+
1. Make sure that your `.env` either has the following settings removed, uncommented, or set to empty. Even though you have set `USE_MANAGED_IDENTITIES=true` the various SDKs that the application uses to interact with these services can still default to key based authentication if these are present:
60
+
```
61
+
AZURE_OPENAI_API_KEY=
62
+
AZURE_OPENAI_DALLE_API_KEY=
63
+
AZURE_COSMOSDB_KEY=
64
+
AZURE_SEARCH_API_KEY=
65
+
AZURE_DOCUMENT_INTELLIGENCE_KEY=
66
+
```
67
+
1. Run this script to grant yourself RBAC permissions on the various Azure resources used by Azure Chat.
52
68
53
69
If you haven't already done so then you will need to login to Azure using the Azure CLI command `az login`
54
70
- In Powershell:
@@ -60,7 +76,7 @@ To deploy the application to Azure App Service with Managed Identities, follow t
60
76
> chmod +x .\scripts\add_localdev_roles.sh
61
77
> .\scripts\add_localdev_roles.sh
62
78
```
63
-
You can now refer to the documentation to [run Azure Chat locally](2-run-locally.md).
// throws error without this - unsure of the root cause (https://stackoverflow.com/questions/76244244/profile-id-is-missing-in-google-oauth-profile-response-nextauth)
0 commit comments