Skip to content

Web App and Cosmos DB for NoSQL API: connect with a managed identity through Microsoft Entra ID - #156

Merged
paolosalvatori merged 8 commits into
mainfrom
smf-1287-cosmos-nosql-managed-identity
Dec 2, 2026
Merged

paolosalvatori merged 8 commits into
mainfrom
smf-1287-cosmos-nosql-managed-identity

Conversation

@paolosalvatori

@paolosalvatori paolosalvatori commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

A customer runs their app against the emulator with the Cosmos DB account key, while on Azure the app connects with a managed identity through Microsoft Entra ID. The emulator now supports that setup: localstack-pro#11500 added SQL role definitions and role assignments, and data-plane checks with LS_AZURE_ENFORCE_RBAC=1. This PR makes the Web App and Cosmos DB for NoSQL API sample show it, in Python and .NET, with every deployment method: the sample had only the Azure CLI scripts, so it also gets a Bicep and a Terraform deployment.

Fixes SMF-1291

Changes

samples/web-app-cosmosdb-nosql-api/{python,dotnet}/
├── scripts/deploy.sh     # MANAGED_IDENTITY_TYPE: None (the account key, as before), SystemAssigned or UserAssigned
├── scripts/validate.sh   # with an identity: the role assignment, then a round trip through the web app
├── bicep/                # new: main.bicep, modules, deploy.sh, README.md
├── terraform/            # new: main.tf, modules, deploy.sh, README.md
├── src/                  # no key: DefaultAzureCredential (Python cosmosdb_client.py, .NET CosmosActivityStore.cs)
└── README.md             # "Microsoft Entra ID authentication", and the Bicep and Terraform deployments
samples/web-app-cosmosdb-mongodb-api/python/terraform/variables.tf   # Python 3.13, see below
samples/*/{python,dotnet,java}/{bicep,scripts,terraform}/           # every sample: PerGB2018 workspaces, carriage returns stripped, see the last point
run-samples.sh            # 12 entries: both identity types, both languages, all three methods
README.md                 # the sample's row
  • scripts/deploy.sh, the same change in both languages, following the Container Apps and Blob Storage sample's MANAGED_IDENTITY_TYPE:
    • None keeps the account key in the AZURECOSMOSDB_PRIMARY_KEY app setting.
    • SystemAssigned gives the web app a system-assigned identity; UserAssigned creates <prefix>-webapp-nosql-identity-<suffix>, assigns it to the web app and passes its client id in AZURE_CLIENT_ID.
    • The identity gets Cosmos DB Built-in Data Contributor (00000000-0000-0000-0000-000000000002) on the whole account with az cosmosdb sql role assignment create --scope "/", unless it already has it, with retries while a new principal replicates to Microsoft Entra ID. The assignment comes right after the web app exists, minutes before the code is deployed, since Azure takes a while to apply it to the data plane.
    • With an identity, no key is read. The credentials a previous run with another identity type left in the app settings are removed: the account key, and for SystemAssigned the client id of a UserAssigned run, with which DefaultAzureCredential would keep using the user-assigned identity.
  • The apps: without a key, the Python and .NET apps pass DefaultAzureCredential to CosmosClient. The deploy scripts still create the database and the container, since Azure refuses to let a Microsoft Entra identity create them whatever its roles; the apps only read them at startup. The .NET app tries the store for two minutes at startup instead of once, for the time Azure takes to apply a new role assignment.
  • validate.sh: with an identity, it checks that the identity has the role, then adds an activity through the web app (with the .NET app's antiforgery token), finds it on the page, and deletes it, which counts only when the app confirms the deletion and could read the activities again, retrying for ten minutes while the app starts or the role takes effect. It uses the native_path and null_device helpers of the Front Door sample, for Git Bash on Windows. It strips the carriage returns of the Windows Azure CLI from the az output it compares.
  • Bicep and Terraform, the same in both languages, modeled on the Web App and Managed Identity sample:
    • The web app always uses a managed identity, chosen with MANAGED_IDENTITY_TYPE: UserAssigned (the default) or SystemAssigned. A user-assigned identity's client id goes in AZURE_CLIENT_ID; no key goes in the app settings.
    • A SQL role assignment gives the identity Cosmos DB Built-in Data Contributor on the account: Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments in Bicep, azurerm_cosmosdb_sql_role_assignment in Terraform.
    • The resources get the names the scripts give them, so scripts/validate.sh, query-telemetry.sh and query-logs-and-metrics.sh check these deployments too.
    • The account's diagnostic setting is created before the database and the container, so its ControlPlaneRequests log records their creation, which query-logs-and-metrics.sh reads.
    • Terraform's deploy.sh exports ARM_METADATA_HOSTNAME only when the az CLI targets the emulator, so the same files deploy to both.
  • MongoDB sample, Terraform: its web app now runs on Python 3.13, like the sample's Bicep and CLI deployments. Since the OpenTelemetry Python contrib packages released 0.66b3 on 2026-12-01, the pip of Oryx's Python 3.12 SDK (25.0.1) stops with ResolutionImpossible on the sample's requirements (opentelemetry-instrumentation-pymongo pinned at 0.66b2, while microsoft-opentelemetry 1.6.0 pulls the newest Django and Flask instrumentations), so the web app's build failed, and with it Test: web-app-cosmosdb-mongodb-api/python/terraform, whatever the PR. The pip of the Python 3.13 SDK (26.2.2) resolves them.
  • Every sample, from the review of this PR:
    • The Log Analytics workspace of every Bicep and Azure CLI deployment is created in the PerGB2018 pricing tier, as the Terraform deployments already did. The Bicep modules, the Bicep parameters that feed them and the CLI scripts used the legacy PerNode tier, which Azure offers only to subscriptions that had a Log Analytics workspace or Application Insights resource on 2018-04-02, or an Enterprise Agreement that started before 2019-02-01 (Legacy pricing tiers), so they failed on newer subscriptions.
    • Every Terraform deploy.sh strips the carriage return the Windows Azure CLI adds in Git Bash from the cloud name, the subscription and tenant ids and the emulator's endpoint it reads; LocalStack\r made it miss the emulator.

Validation

Emulator, with the entries' deploy and test commands from run-samples.sh:

Entries Image Settings Result
Azure CLI scripts: Python and .NET, SystemAssigned and UserAssigned built from main at a3f200ec6f (#11500) LS_AZURE_ENFORCE_RBAC=1 4 passed
Azure CLI scripts: Python UserAssigned, .NET SystemAssigned same default 2 passed
Azure CLI scripts: account key, both languages, with the entries' full test command same LS_AZURE_ENFORCE_RBAC=1 2 passed
Bicep and Terraform: Python and .NET, SystemAssigned and UserAssigned latest at dd49dd4f8c default 8 passed

With LS_AZURE_ENFORCE_RBAC=1, removing the identity's role assignment after a passing run (Python with SystemAssigned, .NET with UserAssigned) makes the web app's page report that it can't load the activities: the apps reach the account as their managed identity, and its role decides.

This PR's CI ran the sample's 14 entries on latest (6a0a8ec16e): all passed. MongoDB: run alone, the emulator's Oryx build image (github-actions-debian-bookworm-20260415.1) fails to install the sample's requirements on Python 3.12 and installs them on 3.13; with this PR, Test: web-app-cosmosdb-mongodb-api/python/terraform passes (6a0a8ec16e).

The later runs' red Cosmos DB checks come from localstack-pro#11506, on latest since 2026-12-02 12:15 UTC (b09d9f519e): every Cosmos DB check that ran on it failed, and every one on 6a0a8ec16e passed. That image answers 500 to az cosmosdb sql database create and sql container create with --throughput (the scripts entries), refuses the private endpoint group id mongodb and a unique _id index next to a shard key (the MongoDB sample's Bicep and Terraform entries). localstack-pro#11571 fixes the three, as Azure answers them: on an emulator image built from it, the five failing entries pass, and so does the MongoDB sample's Python Terraform entry. With that fix in latest (2026-12-02 19:48 UTC), the run on 2996792 passed all 138 checks, these five included.

The review's fixes (dc80e6c to 2996792), with role enforcement on the emulator (an image built from localstack-pro#11571) and on Azure in West Europe:

Entries Emulator Azure
Azure CLI scripts, Python and .NET: a UserAssigned run, then a SystemAssigned run on the same resources. AZURE_CLIENT_ID is gone, and with the user-assigned identity's role assignment deleted, validate.sh still adds, finds and deletes an activity through the web app passed passed
Bicep, Python and .NET, UserAssigned (the PerGB2018 workspace) passed passed
Terraform, Python and .NET, UserAssigned passed passed

With the scripts before the fix, the same SystemAssigned run keeps AZURE_CLIENT_ID, and once the user-assigned identity loses its role, the web app can no longer read or write the activities. The other samples' changes are the same lines (the workspace tier and the four Terraform captures), and this PR's CI runs every sample on the emulator.

Azure, in West Europe, with the same deploy and test commands; every run's resource group is deleted:

Entry Result
Azure CLI scripts, Python, SystemAssigned passed
Azure CLI scripts, Python, UserAssigned passed
Azure CLI scripts, .NET, SystemAssigned passed
Azure CLI scripts, .NET, UserAssigned passed
Bicep, Python, UserAssigned passed
Bicep, .NET, UserAssigned passed
Terraform, Python, UserAssigned passed
Terraform, .NET, UserAssigned passed
MongoDB sample: Terraform, Python (the Python 3.13 change) passed

The .NET Bicep entry's first test run lost two calls to a 15-minute network outage on the test machine (a TLS error on management.azure.com and a Log Analytics timeout, hitting other runs at the same minutes); its test commands passed when run again on the same deployment.

The MongoDB sample's account has a secondary region, North Europe by default. This subscription can't add a Cosmos DB account there for now (Azure: "high demand in North Europe region ... To request region access for your subscription ..."), so that run set the secondary region to France Central with TF_VAR_secondary_region; everything else ran as the sample defines it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FvNuJL1rNfLYAsoentHcLA

…through Microsoft Entra ID

deploy.sh takes MANAGED_IDENTITY_TYPE (None by default, SystemAssigned or UserAssigned), as the
Container Apps and Blob Storage sample does. With an identity, the web app gets a managed identity
with the Cosmos DB Built-in Data Contributor role on the account (a SQL role assignment) and no
account key; the Python and .NET apps then pass DefaultAzureCredential to CosmosClient. With an
identity, validate.sh checks the role assignment, then adds an activity through the web app, reads
it back and deletes it. run-samples.sh runs both identity types for both languages.

Fixes SMF-1291

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvNuJL1rNfLYAsoentHcLA
paolosalvatori and others added 2 commits December 2, 2026 11:45
…with a managed identity

The sample shipped only Azure CLI scripts. It now ships Bicep and Terraform deployments too, for Python and .NET, modeled on web-app-managed-identity: the Log Analytics workspace, Application Insights, the App Service plan, the web app, a user-assigned (default) or system-assigned managed identity (MANAGED_IDENTITY_TYPE), the Cosmos DB for NoSQL account with its database, container and diagnostic setting, and a SQL role assignment that grants the identity Cosmos DB Built-in Data Contributor on the account. The web app gets no key: it reaches the account with DefaultAzureCredential.

The resources get the names the Azure CLI scripts give them, so scripts/validate.sh, query-telemetry.sh and query-logs-and-metrics.sh check these deployments too. The database is created after the account's diagnostic setting, so the ControlPlaneRequests log records its creation, as with the CLI scripts.

run-samples.sh runs both deployments with both identity types in both languages (8 entries), and the READMEs describe them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvNuJL1rNfLYAsoentHcLA
… Bicep and CLI deployments

Since the OpenTelemetry contrib packages released 0.66b3 on 2026-12-01, pip 25.0.1, which Oryx's Python 3.12 SDK ships, stops with ResolutionImpossible on the sample's requirements (opentelemetry-instrumentation-pymongo pinned at 0.66b2, while microsoft-opentelemetry 1.6.0 pulls the newest Django and Flask instrumentations), so the web app's build fails. pip 26.2.2 of the Python 3.13 SDK backtracks to 0.66b2 and installs them. The Bicep template and the CLI scripts already deploy Python 3.13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvNuJL1rNfLYAsoentHcLA

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The legacy Log Analytics pricing default blocks deployment on ineligible subscriptions, while identity switching, deletion validation, and Windows CLI handling also have unresolved defects.

5 open issues
What changed in this PR

Adds managed-identity authentication to the Python and .NET Cosmos DB for NoSQL samples, supporting deployments to both LocalStack and Azure.

Changes:

  • Adds Microsoft Entra ID authentication, identity provisioning, role assignments, and application validation.
  • Introduces Bicep and Terraform deployments and expands the sample runner.
  • Documents authentication options and updates the MongoDB Terraform sample to Python 3.13.
File Description
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​variables.tf Defines deployment settings and identity selection.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​terraform.tfvars Sets region and Python runtime.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​README.md Documents Terraform deployment.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​providers.tf Configures the Azure provider.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​outputs.tf Exposes deployment details.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​web_app/​variables.tf Defines web app configuration inputs.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​web_app/​outputs.tf Exposes web app and identity details.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​web_app/​main.tf Provisions the web app and diagnostics.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​managed_identity/​variables.tf Defines identity inputs.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​managed_identity/​outputs.tf Exposes identity identifiers.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​managed_identity/​main.tf Creates a user-assigned identity.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​log_analytics/​variables.tf Defines workspace settings.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​log_analytics/​output.tf Exposes workspace details.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​log_analytics/​main.tf Creates the workspace and query auditing.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​cosmosdb_nosql/​variables.tf Defines Cosmos DB configuration inputs.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​cosmosdb_nosql/​outputs.tf Exposes Cosmos DB resource details.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​cosmosdb_nosql/​main.tf Creates Cosmos DB resources and diagnostics.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​application_insights/​variables.tf Defines telemetry configuration inputs.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​application_insights/​outputs.tf Exposes telemetry connection details.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​application_insights/​main.tf Creates workspace-based Application Insights.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​app_service_plan/​variables.tf Defines hosting plan settings.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​app_service_plan/​outputs.tf Exposes hosting plan details.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​modules/​app_service_plan/​main.tf Creates the hosting plan and diagnostics.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​main.tf Connects resources and assigns Cosmos DB access.
samples/​web-app-cosmosdb-nosql-api/​python/​terraform/​deploy.sh Deploys infrastructure and Python application code.
samples/​web-app-cosmosdb-nosql-api/​python/​src/​requirements.txt Adds Azure Identity.
samples/​web-app-cosmosdb-nosql-api/​python/​src/​cosmosdb_client.py Uses token authentication when no key exists.
samples/​web-app-cosmosdb-nosql-api/​python/​scripts/​validate.sh Checks roles and application operations.
samples/​web-app-cosmosdb-nosql-api/​python/​scripts/​README.md Documents CLI identity selection.
samples/​web-app-cosmosdb-nosql-api/​python/​scripts/​deploy.sh Provisions identities and Cosmos DB roles.
samples/​web-app-cosmosdb-nosql-api/​python/​README.md Explains authentication and deployment options.
samples/​web-app-cosmosdb-nosql-api/​python/​bicep/​README.md Documents Bicep deployment.
samples/​web-app-cosmosdb-nosql-api/​python/​bicep/​modules/​web-app.bicep Provisions the web app with an identity.
samples/​web-app-cosmosdb-nosql-api/​python/​bicep/​modules/​managed-identity.bicep Creates a user-assigned identity.
samples/​web-app-cosmosdb-nosql-api/​python/​bicep/​modules/​log-analytics.bicep Creates the workspace and query auditing.
samples/​web-app-cosmosdb-nosql-api/​python/​bicep/​modules/​cosmos-db.bicep Creates Cosmos DB resources and diagnostics.
samples/​web-app-cosmosdb-nosql-api/​python/​bicep/​modules/​cosmos-db-sql-role-assignment.bicep Grants Cosmos DB data access.
samples/​web-app-cosmosdb-nosql-api/​python/​bicep/​modules/​application-insights.bicep Creates workspace-based Application Insights.
samples/​web-app-cosmosdb-nosql-api/​python/​bicep/​modules/​app-service-plan.bicep Creates the hosting plan and diagnostics.
samples/​web-app-cosmosdb-nosql-api/​python/​bicep/​main.bicepparam Sets resource naming and Python runtime.
samples/​web-app-cosmosdb-nosql-api/​python/​bicep/​deploy.sh Deploys infrastructure and Python application code.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​variables.tf Defines deployment settings and identity selection.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​terraform.tfvars Sets region and .NET runtime.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​README.md Documents Terraform deployment.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​providers.tf Configures the Azure provider.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​outputs.tf Exposes deployment details.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​web_app/​variables.tf Defines web app configuration inputs.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​web_app/​outputs.tf Exposes web app and identity details.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​web_app/​main.tf Provisions the web app and diagnostics.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​managed_identity/​variables.tf Defines identity inputs.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​managed_identity/​outputs.tf Exposes identity identifiers.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​managed_identity/​main.tf Creates a user-assigned identity.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​log_analytics/​variables.tf Defines workspace settings.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​log_analytics/​output.tf Exposes workspace details.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​log_analytics/​main.tf Creates the workspace and query auditing.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​cosmosdb_nosql/​variables.tf Defines Cosmos DB configuration inputs.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​cosmosdb_nosql/​outputs.tf Exposes Cosmos DB resource details.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​cosmosdb_nosql/​main.tf Creates Cosmos DB resources and diagnostics.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​application_insights/​variables.tf Defines telemetry configuration inputs.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​application_insights/​outputs.tf Exposes telemetry connection details.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​application_insights/​main.tf Creates workspace-based Application Insights.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​app_service_plan/​variables.tf Defines hosting plan settings.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​app_service_plan/​outputs.tf Exposes hosting plan details.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​modules/​app_service_plan/​main.tf Creates the hosting plan and diagnostics.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​main.tf Connects resources and assigns Cosmos DB access.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​terraform/​deploy.sh Deploys infrastructure and .NET application code.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​src/​VacationPlanner.csproj Adds Azure Identity.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​src/​Services/​CosmosOptions.cs Makes the account key optional.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​src/​Services/​CosmosActivityStore.cs Uses token authentication when no key exists.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​src/​Program.cs Adds startup initialization retries.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​scripts/​validate.sh Checks roles and application operations.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​scripts/​README.md Documents CLI identity selection.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​README.md Explains authentication and deployment options.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​bicep/​README.md Documents Bicep deployment.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​bicep/​modules/​web-app.bicep Provisions the web app with an identity.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​bicep/​modules/​managed-identity.bicep Creates a user-assigned identity.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​bicep/​modules/​log-analytics.bicep Creates the workspace and query auditing.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​bicep/​modules/​cosmos-db.bicep Creates Cosmos DB resources and diagnostics.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​bicep/​modules/​cosmos-db-sql-role-assignment.bicep Grants Cosmos DB data access.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​bicep/​modules/​application-insights.bicep Creates workspace-based Application Insights.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​bicep/​modules/​app-service-plan.bicep Creates the hosting plan and diagnostics.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​bicep/​main.bicepparam Sets resource naming and .NET runtime.
samples/​web-app-cosmosdb-nosql-api/​dotnet/​bicep/​deploy.sh Deploys infrastructure and .NET application code.
samples/​web-app-cosmosdb-mongodb-api/​python/​terraform/​variables.tf Changes the default runtime to Python 3.13.
run-samples.sh Adds twelve managed-identity deployment checks.
README.md Updates the NoSQL sample description.

Review effort: Balanced

paolosalvatori and others added 5 commits December 2, 2026 16:50
…hich any subscription can use

The Bicep modules, the Bicep parameters that feed them, and the Azure CLI scripts created the workspaces in the legacy PerNode tier. Azure offers it only to subscriptions that had a Log Analytics workspace or Application Insights resource on 2018-04-02, or an Enterprise Agreement that started before 2019-02-01 (https://learn.microsoft.com/azure/azure-monitor/logs/cost-logs#legacy-pricing-tiers), so on any other subscription these deployments failed. The Terraform modules already used PerGB2018.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvNuJL1rNfLYAsoentHcLA
…ssigned run when the web app switches to its system-assigned identity

After a run with MANAGED_IDENTITY_TYPE=UserAssigned, a run with SystemAssigned left AZURE_CLIENT_ID in the app settings, so DefaultAzureCredential kept using the user-assigned identity and validate.sh passed without the system-assigned one. A SystemAssigned run now removes AZURE_CLIENT_ID along with the account key of a run without an identity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvNuJL1rNfLYAsoentHcLA
…az output validate.sh compares

With the Windows Azure CLI in Git Bash, every tsv line ends with a carriage return, which broke the web app's URL, the principal id the role assignments are matched against, and the count of those assignments. They now go through tr -d '\r', as the sample's other scripts do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvNuJL1rNfLYAsoentHcLA
…eb app confirms it and could read the activities again

After a failed read the app renders its form with no activities, so a failed deletion followed by a failed read passed the check. validate.sh now also requires the app's "Activity deleted." message and refuses its "Failed to load the activities." message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvNuJL1rNfLYAsoentHcLA
…ption, tenant and endpoint deploy.sh reads

With the Windows Azure CLI in Git Bash, these tsv values end with a carriage return: "LocalStack\r" failed the comparison that points Terraform at the emulator, and the subscription and tenant ids passed to Terraform carried it too. Every Terraform deploy.sh now strips it with tr -d '\r'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvNuJL1rNfLYAsoentHcLA

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants