Skip to content

Commit bc3f20e

Browse files
Merge pull request #748 from microsoft/psl-bug-29988
fix: Improve the LocalDevelopmentSetup.md documentation to enhance clarity and make the setup steps easier for users to follow.
2 parents ef74a4e + f696841 commit bc3f20e

1 file changed

Lines changed: 76 additions & 24 deletions

File tree

docs/LocalDevelopmentSetup.md

Lines changed: 76 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ winget install OpenJS.NodeJS.LTS
8282
py -3.12 -m pip install uv
8383
```
8484

85-
**Note**: On Windows, use `py -3.12 -m uv` instead of `uv` for all commands to ensure you're using Python 3.12.
86-
8785
#### Option 2: Windows with WSL2 (Recommended)
8886

8987
```bash
@@ -219,41 +217,86 @@ To run the application locally, your Azure account needs the following role assi
219217

220218
The **main.bicep** deployment includes the assignment of the appropriate roles to AOAI, Storage account, Search service and Cosmos services. If you want to use resource group which is not deployed by you for local debugging—you will need to add your own credentials to access the Cosmos Storage account, Search service and AOAI services. You can add these permissions using the following commands:
221219

222-
#### Get Principal Id
220+
#### Get Your Microsoft Entra ID User Object ID (Principal ID)
221+
222+
Your Azure AD User Object ID (also called Principal ID) is required for the role assignments below. Choose either method to obtain it:
223+
224+
**Method 1: Using Azure CLI (Recommended)**
223225
```bash
224226
az ad signed-in-user show --query id -o tsv
225227
```
226228

229+
**Method 2: Using Azure Portal**
230+
1. Go to [Azure Portal](https://portal.azure.com)
231+
2. Open **Microsoft Entra ID** (or search "Entra")
232+
3. In the left menu, select **Users**
233+
4. Select your account
234+
5. Under **Identity**, copy the **Object ID**
235+
236+
> **Note:** The `<aad-user-object-id>` and `<principal-id>` in the commands below refer to the same ID obtained from either method above.
237+
238+
#### Get Your Azure AD User Principal Name (UPN)
239+
240+
Your Azure AD User Principal Name (UPN) is your sign-in email address and is required for some role assignments. Choose either method to obtain it:
241+
242+
**Method 1: Using Azure CLI (Recommended)**
243+
```bash
244+
az ad signed-in-user show --query userPrincipalName -o tsv
245+
```
246+
247+
**Method 2: Using Azure Portal**
248+
1. Go to [Azure Portal](https://portal.azure.com)
249+
2. Open **Microsoft Entra ID** (or search "Entra")
250+
3. In the left menu, select **Users**
251+
4. Select your account
252+
5. Copy the **User principal name** (typically your email address, e.g., user@domain.com)
253+
254+
> **Note:** The `<aad-user-upn>` in the commands below refers to your User Principal Name obtained from either method above.
255+
227256
#### Cosmos DB Access
257+
228258
```bash
229259
# Assign Cosmos DB Built-in Data Contributor role
230260
az cosmosdb sql role assignment create --resource-group <solution-accelerator-rg> --account-name <cosmos-db-account-name> --role-definition-name "Cosmos DB Built-in Data Contributor" --principal-id <aad-user-object-id> --scope /subscriptions/<subscription-id>/resourceGroups/<solution-accelerator-rg>/providers/Microsoft.DocumentDB/databaseAccounts/<cosmos-db-account-name>
231261
```
232262

233-
#### AI Foundry access
263+
#### AI Foundry Access
264+
265+
**To get your AI Foundry Project Resource ID:**
266+
1. Go to [Azure Portal](https://portal.azure.com)
267+
2. Navigate to your AI Foundry Project resource
268+
3. In the **Project details** section, find and copy the **Project resource ID**
269+
4. The format should be: `/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.CognitiveServices/accounts/<foundry-account-name>/projects/<foundry-project-name>`
270+
271+
> **Note:** For AI Foundry, you need the complete project resource ID path (not just the account name). Use the full path shown in the Project resource ID field.
272+
273+
**Assign the required roles:**
234274

235275
```bash
236-
az role assignment create --assignee <aad-user-upn> --role "Azure AI User" --scope /subscriptions/<subscription-id>/resourceGroups/<solution-accelerator-rg>/providers/Microsoft.CognitiveServices/accounts/<azure-ai-foundry-name>
276+
# Azure AI User role
277+
az role assignment create --assignee <aad-user-upn> --role "Azure AI User" --scope /subscriptions/<subscription-id>/resourceGroups/<solution-accelerator-rg>/providers/Microsoft.CognitiveServices/accounts/<foundry-account-name>/projects/<foundry-project-name>
237278
```
238279

239280
```bash
240-
az role assignment create --assignee <aad-user-upn> --role " Azure AI Developer " --scope /subscriptions/<subscription-id>/resourceGroups/<solution-accelerator-rg>/providers/Microsoft.CognitiveServices/accounts/<azure-ai-foundry-name>
281+
# Azure AI Developer role
282+
az role assignment create --assignee <aad-user-upn> --role "Azure AI Developer" --scope /subscriptions/<subscription-id>/resourceGroups/<solution-accelerator-rg>/providers/Microsoft.CognitiveServices/accounts/<foundry-account-name>/projects/<foundry-project-name>
241283
```
242284

243285
```bash
244-
az role assignment create --assignee <aad-user-upn> --role " Cognitive Services OpenAI User " --scope /subscriptions/<subscription-id>/resourceGroups/<solution-accelerator-rg>/providers/Microsoft.CognitiveServices/accounts/<azure-ai-foundry-name>
286+
# Cognitive Services OpenAI User role
287+
az role assignment create --assignee <aad-user-upn> --role "Cognitive Services OpenAI User" --scope /subscriptions/<subscription-id>/resourceGroups/<solution-accelerator-rg>/providers/Microsoft.CognitiveServices/accounts/<foundry-account-name>/projects/<foundry-project-name>
245288
```
246289

247290
#### Search Service Access
248291

249-
```bash
250-
az role assignment create --assignee <aad-user-upn> --role "Search Index Data Contributor" --scope /subscriptions/ <subscription-id> /resourceGroups/ <solution-accelerator-rg> /providers/Microsoft.Search/searchServices/<Search-service-name>
292+
```bash
293+
az role assignment create --assignee <aad-user-upn> --role "Search Index Data Contributor" --scope /subscriptions/<subscription-id>/resourceGroups/<solution-accelerator-rg>/providers/Microsoft.Search/searchServices/<search-service-name>
251294
```
252295

253296
#### Storage Account Access
254297

255298
```bash
256-
az role assignment create --assignee <aad-user-upn> --role "Storage Blob Data Contributor" --scope /subscriptions/ <subscription-id> /resourceGroups/ <solution-accelerator-rg> /providers/Microsoft.Storage/storageAccounts/<storage-account-name>
299+
az role assignment create --assignee <aad-user-upn> --role "Storage Blob Data Contributor" --scope /subscriptions/<subscription-id>/resourceGroups/<solution-accelerator-rg>/providers/Microsoft.Storage/storageAccounts/<storage-account-name>
257300
```
258301

259302

@@ -271,7 +314,7 @@ cd src/backend
271314

272315
### 4.2. Configure Backend Environment Variables
273316

274-
Create a `.env` file in the `src/backend` directory:
317+
**Step 1: Create the `.env` file**
275318

276319
```bash
277320
# Create .env file
@@ -280,25 +323,34 @@ touch .env # Linux
280323
New-Item .env # Windows PowerShell
281324
```
282325

283-
Add the following to the `.env` file:
326+
**Step 2: Copy the template**
284327

285-
- Copy all the values from `.env.example` (CTRL + A) and (CTRL +C)
286-
- Paste all copied value to `.env` (CTRL + V)
328+
1. Open the `.env.sample` file
329+
2. Select all content (CTRL + A)
330+
3. Copy (CTRL + C)
331+
4. Open the new `.env` file
332+
5. Paste (CTRL + V)
287333

288-
Get All the values from the Backend container app from Azure portal
334+
**Step 3: Get Azure values and update `.env`**
289335

290-
- Go to your resource group
291-
- open the backend container
292-
- Go to Environment variables of containers
336+
1. Open [Azure Portal](https://portal.azure.com)
337+
2. Navigate to your **Resource Group**
338+
3. Open the **Backend Container App**
339+
4. Click **Environment variables** in the left menu
340+
5. Copy each value from Azure and update the corresponding variable in your `.env` file
293341

294-
For reference, see the image below:
342+
For reference:
295343
![Environment_variables_example](./images/Environment_varibles_example.png)
296344

297-
- Make sure to set APP_ENV to "**dev**"
298-
- Keep Below variables as it is from `.env.example`.
299-
- `BACKEND_API_URL=http://localhost:8000`
300-
- `FRONTEND_SITE_NAME=http://127.0.0.1:3000`
301-
- `MCP_SERVER_ENDPOINT=http://localhost:9000/mcp`
345+
**Step 4: Update local development settings**
346+
347+
In your `.env` file, make these changes:
348+
349+
- Set `APP_ENV=dev`
350+
- Keep these local URLs (do NOT change them):
351+
- `BACKEND_API_URL=http://localhost:8000`
352+
- `FRONTEND_SITE_NAME=*`
353+
- `MCP_SERVER_ENDPOINT=http://localhost:9000/mcp`
302354

303355
### 4.3. Install Backend Dependencies
304356

0 commit comments

Comments
 (0)