Skip to main content

Store files in Azure Blob Storage

Connect a Builder app to Azure Blob Storage using managed identity instead of storage keys. A Node.js sample API and static frontend upload, list, download, and delete files; credentials never reach the browser.

Preview sample: development and testing only

Use disposable files and a separate test account; don't relax an existing account's firewall. A private container disables anonymous reads, not the public network endpoint. Managed identity protects app-to-storage access, not visitors: every allowed visitor can read, write, and delete every file, so require Builder visitor sign-in with explicit testers.

Prerequisites​

  • An Azure subscription in West US 2 (westus2) with Node.js 24 support.
  • Git, Azure CLI with Bicep, and permission to provision storage and assign data roles (app creation permission alone isn't enough).
  • A GitHub fork with the Builder GitHub App installed before provisioning, including public forks (GitHub authorization).
  • A storage endpoint reachable from Builder, which has no VNet/private endpoint connectivity or stable outbound IP.

1. Prepare the sample and storage​

Clone the sample​

Fork the Blob Storage sample and clone your fork:

git clone "<your-fork-https-url>" filevault
cd filevault

Provision Blob Storage​

Set a new test resource group and a globally unique storage name (3-24 lowercase letters and digits):

SUBSCRIPTION="<subscription-id>"
TENANT="<tenant-id>"
RG="<new-test-resource-group>"
STORAGE="<globally-unique-storage-account-name>"
STORAGE_LOCATION="westus2"

az login --tenant "$TENANT"
az group create --subscription "$SUBSCRIPTION" \
--name "$RG" --location "$STORAGE_LOCATION"
az deployment group what-if --subscription "$SUBSCRIPTION" \
--resource-group "$RG" --name filevault-storage \
--template-file infra/main.bicep \
--parameters storageAccountName="$STORAGE" location="$STORAGE_LOCATION"

Review storage costs. The template creates Standard_LRS/Hot StorageV2 with HTTPS only, Shared Key disabled, and a private filevault container.

az deployment group create --subscription "$SUBSCRIPTION" \
--resource-group "$RG" --name filevault-storage \
--template-file infra/main.bicep \
--parameters storageAccountName="$STORAGE" location="$STORAGE_LOCATION"
az deployment group show --subscription "$SUBSCRIPTION" \
--resource-group "$RG" --name filevault-storage \
--query properties.outputs -o json

Record blobEndpoint, containerScope, and storageAccountId. Keep keys and connection strings out of app variables.

2. Create the app and enable managed identity​

Review the build settings​

The sample has two independent component roots:

SettingFrontendAPI
Component and source directorystatic, client/web, server/
Platformnodejs, version "24"nodejs, version "24"
Custom buildnpm ci --include=dev && npm run build:buildernpm ci --omit=dev && npm run build:builder
Output or startupdistnode index.js
App path//api, port 8080
Health checkNone/api/health checks process health, not Blob access

Keep Vite/React dependencies in client/, not the API package. Leave AZURE_CLIENT_ID unset for the system-assigned identity (managed identity covers user-assigned).

Connection-string fallback

The Blob connection can instead use a protected connection string when managed identity is not available. Connection strings can contain an account key or SAS and require the selected account to allow that authentication method. Enter the value only in Builder Portal. Ordinary reads and Builder CLI output omit it.

Create the app​

Use your test group and West US 2. In Authentication, require Microsoft Entra sign-in. After creation, enable a system-assigned identity on the app's Identity page. If initial health fails before configuration is complete, keep the app and continue.

Keep the fork, branch, and root builder.yaml you prepared above. Builder deploys committed GitHub source, not uncommitted local files.

Open the App Service Builder Portal. Your Azure account needs permission to create and deploy Microsoft.Web/builderApps resources. Creating a resource group also requires permission to create groups in the selected subscription.

  1. Sign in to the Portal with your Microsoft account.

  2. Select the subscription and choose Create.

  3. In Choose approach, keep Let Builder handle it selected and select Next.

    Create Builder App wizard with Let Builder handle it selected beside ZIP deploy; the steps include Connect GitHub, Authentication, App details, and Review.
    Choose Builder-managed GitHub source for this procedure. ZIP deploy is the separate local-source path; include a root builder.yaml for ZIP deployments. Review authentication and the target before submitting either approach.
  4. In Connect GitHub, sign in to GitHub and authorize the OAuth App. Keep Use my repository selected to deploy the fork you prepared above. Choose the account or organization that owns your fork, then select that repository and branch. Use Change account if you need a different GitHub account, or Refresh access after changing repository permissions. The App Service Builder GitHub App needs access to this repository to read your code, build it, and deploy your app. Signing in to GitHub alone does not grant this access. If prompted, select Install GitHub App and grant access to your selected repository, or add it to an existing installation. Close the GitHub window to refresh access, or select Refresh access after approval. Select Next when Builder is connected and GitHub App access confirmed are shown. To keep the defaults, select Review directly once it is enabled. Builder generates an app name, uses the selected subscription and first available resource group, and supplies the app region. You do not need to visit Authentication or App details when their defaults meet your needs. Review the authentication summary before creating; organization-required sign-in defaults still apply.

  5. In Authentication, configure visitor sign-in. Review the sign-in mode; some organization directories default to required tenant sign-in. When offered, select Apply under Require sign-in with a work account from your organization to limit the app to accounts in your Microsoft Entra directory. Select Off only if you intend to allow anonymous visitors. Select Next.

  6. In App details, enter an app name and select the subscription, resource group, and West US 2 (westus2). To create a resource group, select Create new, enter its name, and choose Resource group region. Select Add. The group appears as (new) and is created when you submit. Its region stores the resource group's metadata and does not change the app's region. Select Next.

  7. On Review and create, confirm the app, repository, branch, subscription, resource group, app region, and authentication choices. Select Create and deploy.

  8. Open the app's Versions page and wait for the deployment to succeed. Open a version to inspect its source revision, component results, and build logs. Choose View logs to inspect the latest deployment's steps and logs. On Overview, use Browse to open the app URL.

Managed identity is separate from visitor sign-in and is not assigned during Portal creation. To let the app access Azure resources, configure managed identity afterward from the app's Identity page.

Already prepared a fork? Keep Use my repository selected so you deploy that source, not a second copy. To start with a new sample instead, follow Create from a Portal template. Use GitHub Actions is marked Coming soon; use the Builder-managed approach for this preview.

If group creation fails, app creation does not start. If the group was created before a later failure, it remains in Azure; cancelling does not delete it. Check the existing group and app before retrying, and inspect a group's contents before deleting it separately.

See GitHub authorization requirements for organization approvals and SSO. If app creation succeeds but deployment cannot start, read the error and retry deployment on the existing app rather than creating a duplicate. For “Source revision does not contain builder.yaml”, push the missing manifest before retrying.

For API automation, use the ARM API deployment guide with this same fork, branch, and source root ".". ARM and Bicep infrastructure templates provision the resource; separately authorize and connect this source, then deploy it through CLI or ARM.

  1. On Authentication, require Microsoft Entra sign-in and Limit to specific identities with your tenant and tester object IDs (a tenant-only rule permits everyone).
  2. On Identity, enable the system-assigned identity and select Save and deploy. Record its principal ID, not a client ID.

3. Grant container access and configure the app​

Grant Storage Blob Data Contributor at the container scope (Azure Contributor isn't a blob data role).

APP_PRINCIPAL_ID="<app-identity-principal-id>"
az deployment group create --subscription "$SUBSCRIPTION" \
--resource-group "$RG" --name filevault-app-role \
--template-file infra/role.bicep \
--parameters storageAccountName="$STORAGE" principalId="$APP_PRINCIPAL_ID"

Record roleAssignmentId for cleanup. Role propagation can take time; see Blob data-role guidance.

On Connections, add Storage account, select the existing account and app's system-assigned Managed identity, then save these runtime mappings:

VariableValue
AZURE_STORAGE_BLOB_ENDPOINTThe HTTPS blobEndpoint output
AZURE_STORAGE_CONTAINERfilevault

Keep APP_ACCESS_MODE=builder as a separate variable (or omit its default) and leave AZURE_CLIENT_ID unset. The sample is MI-only; the platform's Connection string alternative does not change its Shared-Key-disabled dependency or authorize a fallback.

Named connection mappings​

The managed-identity Connections workflow completed hosted Production qualification for Blob Storage with both system-assigned and user-assigned identities. It records the existing storage account/container and already-assigned identity. Rename the account-URL mapping to this sample's AZURE_STORAGE_BLOB_ENDPOINT, not the catalog suggestion AZURE_STORAGE_ACCOUNT_URL. Keep the container mapping AZURE_STORAGE_CONTAINER=filevault. When replacing manual entries, save their removal without deploying, save the corresponding connection mappings, then deploy the complete desired configuration once. Retain APP_ACCESS_MODE=builder and documented SDK identity selection separately. The sample uploads/deletes files, so retain its container-scoped Contributor grant above; the default connection Reader proposal is insufficient for those operations. Do not submit a second grant merely to save a connection. Save desired mappings, deploy explicitly, then verify actual file operations. The deployed catalog exposes this configuration path; actual file operations still verify the selected source and destination. For a complete connection object and a guarded update preserving other connections, use the Builder CLI procedure with a release that includes app connections, or the Azure CLI/ARM procedure.

Optional: start with synthetic demo files​

After connection/access setup, review the sample's demo-files/ and explicitly upload three tiny fictional TXT/CSV files for a populated first file browser:

npm run seed:files -- --subscription "$SUBSCRIPTION" \
--account-name "$STORAGE" --container-name filevault --confirm-demo-seed

The signed-in Azure CLI setup identity needs its own container-scoped Storage Blob Data Contributor grant; the app's grant does not authorize the caller. Follow the sample README's developer-role step if needed. The helper uses Entra login and conditional create-only uploads under filevault-demo/; repeat runs preserve existing blobs, never overwrite/delete and never change container public access. It runs only when explicitly requested, not at app startup. Connections alone do not create files. Refresh the authenticated app to confirm actual connected content. Download the seeded TXT/CSV files through the app and compare them with demo-files/; successful CLI uploads alone do not prove that the file-browser links work. Local helper tests are separate from hosted file-operation qualification.

4. Deploy and verify file operations​

Saving Connections or variables doesn't update the running version. Build and deploy a new version, then open the URL from Overview; signed-out visitors must be asked to sign in.

Actual connected FileVault browser with two synthetic files, 124 bytes, and download/delete actions.

This capture shows real authenticated UI uploads on the tested sample, not the optional seed helper. It contains synthetic TXT/CSV data; generated UUIDs identify blob names, not users or managed identities.

  1. Sign in as an allowed tester and upload a small disposable text file.
  2. Refresh the list and confirm it appears.
  3. Download it through the app and compare the contents with the original.
  4. Delete it and refresh to confirm it is gone.

Sample Upload Files dialog with a PNG and text file queued for upload.

Illustrative queued-upload state from an earlier sample capture; selecting files is not a completed upload. Use harmless test files and verify their saved contents separately.

To check persistence, leave one file, deploy a new version, and confirm it remains.

Troubleshoot connection failures​

Check variables, identity, container role, and firewall with service connection diagnostics. A health response doesn't prove Blob access.

Clean up resources​

Delete your disposable test files first.

Delete only the test app you created when you no longer need it. App deletion does not remove your GitHub repository, resource group, or separately owned services and user-assigned identities.

On updated targets, deletion first reports that it was accepted and then continues in the background. In the Portal, keep the Deleting app's progress available until it completes. With the updated Builder CLI, deletion waits by default; --no-wait returns an operation URL that you can inspect with builder app status. Closing the client does not cancel an accepted deletion. Recently published apps can wait for the remaining one-hour upload grant plus a two-minute drain, and provider failures can extend the wait. The same app name in the same subscription and resource group stays unavailable until deletion finishes. Full artifact cleanup remains under construction; existing lifecycles retain their earlier cleanup scope.

Return to the app inventory and choose Delete from the test app's actions. Alternatively, open the app's Settings and select Delete under Danger zone. Enter the exact app name and choose Delete. The dialog closes when the service accepts the request, without waiting for cleanup to finish. The app remains visible as Deleting, with changes disabled while cleanup runs. Deleting from Settings keeps the app open so you can follow its deletion progress.

A notification names the app and reports progress, then success or failure. You can open another app without losing deletion progress. Use the bell beside Docs and All activity to review it. If the request is rejected, the dialog shows the error and lets you retry. Deletion progress includes the current cleanup step and retry details when available. Wait for deletion to complete before creating another app with the same name. Refreshing or closing the Portal clears this session's tracking; it does not cancel server-side cleanup.

Deleting the Builder app doesn't delete storage or stop its charges. After confirming ownership (never delete a shared resource group) and accepting data loss, remove the test role and dedicated account:

az role assignment delete --subscription "$SUBSCRIPTION" \
--ids "<recorded-sample-role-assignment-id>"
az storage account delete --subscription "$SUBSCRIPTION" \
--resource-group "$RG" --name "$STORAGE"