Skip to content

Commit b7c426f

Browse files
Update Deployment Guide: Clarify VS Code Dev Containers section and add safe redeployment workflow
1 parent 13fc800 commit b7c426f

File tree

1 file changed

+46
-59
lines changed

1 file changed

+46
-59
lines changed

docs/DeploymentGuide.md

Lines changed: 46 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ You can run this solution using GitHub Codespaces. The button will open a web-ba
9797
</details>
9898

9999
<details>
100-
<summary><b>Deploy in VS Code</b></summary>
100+
<summary><b>Deploy in VS Code Dev Containers</b></summary>
101101

102102
### VS Code Dev Containers
103103

@@ -215,43 +215,52 @@ For **production deployments**, the repository also provides [`main.waf.paramete
215215

216216
---
217217

218+
### 🔁 Safe Redeployment or Environment Update Workflow
219+
220+
**[!IMPORTANT]**
221+
> **Never run `azd init` again after your initial setup.** Doing so can overwrite your configuration and break your deployment.
222+
223+
For subsequent deployments or environment changes, use one of the following safe approaches:
224+
225+
#### Option 1: Create a New Environment (Recommended for Clean Redeployments)
226+
227+
Create a fresh deployment environment with its own settings and resource group:
228+
```bash
229+
azd env new <your-new-env-name>
230+
```
231+
232+
#### Option 2: Update Your Current Environment Settings
233+
234+
To modify settings (e.g., Azure region, resource suffix), edit the environment file directly:
235+
```bash
236+
azd env set AZURE_LOCATION <your-desired-location>
237+
```
238+
218239
### 🔒 Security Considerations for Cosmos DB
219240

220-
This solution deploys Cosmos DB with security controls aligned to the **Azure Well-Architected Framework**. Access is **never public by default** — all access is explicitly controlled via **managed identities**, **role-based access control (RBAC)**, and **private networking**.
221-
222-
#### 📌 Intended Access Level
223-
- **Public network access**: **Disabled** (when `enablePrivateNetworking = true`, which is the default for WAF-aligned deployments).
224-
- **Private access**: Enabled via **Private Endpoints** integrated with your virtual network.
225-
- **No public write or read access** is allowed from the internet.
226-
227-
> 💡 In sandbox mode (`main.parameters.json`), public access may be enabled for rapid testing. **Do not use sandbox settings in production.**
228-
229-
#### ✅ Allowed Operations
230-
| Operation | Allowed? | Details |
231-
|------------------|----------|--------|
232-
| Read (data) | ✅ Yes | Via assigned managed identity with **Cosmos DB Built-in Data Reader** or **Contributor** role |
233-
| Write (data) | ✅ Yes | Via assigned managed identity with **Cosmos DB Built-in Data Contributor** role |
234-
| Control-plane ops (create/delete DB) | ❌ No (for apps) | Only deployment principal (user or service principal running `azd up`) has control-plane access |
235-
236-
#### 👥 Authorized Principals & Network Paths
237-
- **Identity-based access**:
238-
- The **application’s user-assigned managed identity** is granted fine-grained data-plane roles:
239-
- `Cosmos DB Built-in Data Contributor` (for read + write)
240-
- *Or* `Cosmos DB Built-in Data Reader` (if read-only)
241-
- **No shared keys or connection strings** are used — all access uses **Azure AD authentication** (token-based).
242-
- **Network-based access**:
243-
- Traffic flows exclusively over **private endpoints** within your virtual network.
244-
- **No public IPs** or internet-facing endpoints are exposed for Cosmos DB.
245-
- Network Security Groups (NSGs) and Azure Firewall rules (if configured) further restrict lateral movement.
246-
247-
#### ⚠️ Important Notes
248-
- If you **disable private networking** (`enablePrivateNetworking = false`), the Cosmos DB account will allow public access — **not recommended for production**.
249-
- Always review and **remove unnecessary role assignments** post-deployment.
250-
- Audit access using **Azure Activity Logs** and **Cosmos DB diagnostic logs** (enabled by default in WAF mode).
251-
252-
For more details, see:
253-
- [Azure Cosmos DB Role-Based Access Control](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-setup-rbac)
254-
- [Secure access to Cosmos DB using Private Endpoints](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-configure-private-endpoints)
241+
This solution uses Azure AD-based RBAC (not account keys) for Cosmos DB data access. The level of network exposure depends on your deployment mode:
242+
243+
**WAF-Aligned Deployment** (enablePrivateNetworking = true)
244+
245+
- Network access: Private only — Cosmos DB is not reachable from the public internet.
246+
247+
- Access path: Application (Container Apps) → Private Endpoint in backendSubnet → Cosmos DB.
248+
249+
- Authentication: Via user-assigned managed identity.
250+
251+
- Role assigned: Cosmos DB Built-in Data Contributor → full read + write to all data.
252+
253+
- Who can access: Only the app’s managed identity. No human users or public endpoints.
254+
255+
⚠️ **Sandbox Deployment** (enablePrivateNetworking = false)
256+
257+
- Network access: Public endpoint enabled — Cosmos DB accepts requests from the internet.
258+
259+
- Authentication: Still Azure AD RBAC only (no account keys).
260+
261+
- Role assigned: Same Cosmos DB Built-in Data Contributor → full read + write.
262+
263+
- Who can access: Only the app’s managed identity — no additional users or groups are granted access.
255264

256265
### Deploying with AZD
257266

@@ -350,36 +359,14 @@ Check all resources in your environment's resource group
350359

351360
> 💡 **Please refer:**
352361

353-
![Image showing the post deployment scripts](../docs/images/macae-post-deployment.png)
362+
![Image showing the post deployment scripts](../docs/images/macae-post-deployment.png)
354363

355364
3. Once the deployment has completed successfully, open the [Azure Portal](https://portal.azure.com/), go to the deployed resource group, find the App Service, and get the app URL from `Default domain`.
356365

357366
4. When Deployment is complete, follow steps in [Set Up Authentication in Azure App Service](../docs/azure_app_service_auth_setup.md) to add app authentication to your web app running on Azure App Service
358367

359368
5. If you are done trying out the application, you can delete the resources by running `azd down`.
360369

361-
### 🔁 Safe Redeployment or Environment Update Workflow
362-
363-
> [!IMPORTANT]
364-
> **Never run `azd init` again after your initial setup.** Doing so can overwrite your configuration and break your deployment.
365-
366-
For subsequent deployments or environment changes, use one of the following safe approaches:
367-
368-
#### Option 1: Create a New Environment (Recommended for Clean Redeployments)
369-
370-
Create a fresh deployment environment with its own settings and resource group:
371-
```bash
372-
azd env new <your-new-env-name>
373-
```
374-
375-
#### Option 2: Update Your Current Environment Settings
376-
377-
To modify settings (e.g., Azure region, resource suffix), edit the environment file directly:
378-
```bash
379-
azd env set AZURE_LOCATION <your-desired-location>
380-
```
381-
382-
383370
### 🛠️ Troubleshooting
384371
If you encounter any issues during the deployment process, please refer [troubleshooting](../docs/TroubleShootingSteps.md) document for detailed steps and solutions.
385372

0 commit comments

Comments
 (0)