Home / Token Setup / Azure Foundation
Token Setup: Azure Foundation
The Azure side of TokenBroker: what was provisioned, how, and the lessons that cost time the first time through (2026-11-28).
Resources
| Thing | Value |
|---|---|
| Subscription | Example subscription, id |
| Tenant | |
| Resource group | rg-tokenbroker (West US 2) |
| Function App | tokenbroker-example, Flex Consumption, Linux, .NET 11 isolated |
| Function App identity | system-assigned managed identity, principal |
| Key Vault | kv-tokenbroker-example, RBAC authorization on |
| Storage account | sttokenbrokerexample, Standard_LRS, blob public access off |
Role assignments on the vault:
- Function App identity: Key Vault Secrets User (read at runtime).
- Account owner: Key Vault Secrets Officer (bootstrap and rotations).
Configuration lives in config files, not Azure app settings:
appsettings.json (committed defaults) and appsettings.Local.json
(gitignored; the real KeyVaultUri), the latter carried in the
deployment package. The original deployment used app settings
(KeyVaultUri, ZohoAccountsBase, ZohoMailBase) until 2026-11-28,
when they were deleted after the config-file setup was verified end
to end; environment variables still override file values when set.
Tooling on the deployment machine
- Azure CLI 2.93.0.
- Azure Functions Core Tools 4.17.0 (
func). - .NET SDK 11.0.100 (the repo's
global.jsonpins it, rollForward latestFeature). On machines wheredotnet-install.shfails (for example a very small /tmp), install the SDK by extracting the official tarball instead.
Signing in (the MFA catch)
Plain device-code sign-in reads fine, but ARM writes fail with AADSTS50076: the tenant's Conditional Access requires an MFA-satisfied token for resource changes. The working recipe:
az logoutaz login --use-device-code --tenant <tenant-id> --scope "https://management.core.windows.net//.default" --claims-challenge <base64 from the AADSTS50076 error>- Complete the sign-in including Authenticator MFA when prompted.
Use the claims challenge value from your own AADSTS50076 error (it encodes the acrs claim your tenant requires; if a future error gives a different value, use the new one).
Why Flex Consumption and .NET 11
- .NET 11 shipped 2026-11-10 (STS, supported to November 2028). .NET 8 and 9 reached end of support the same day, and the Azure Functions in-process model retired the same day.
- Azure Functions GA supports .NET 11 and .NET 10, isolated worker
model only. The project uses Project SDK
Azure.Functions.Sdk1.1.0 withMicrosoft.Azure.Functions.Worker2.52.0. - Linux Consumption does not support .NET 10 or later, so the plan is Flex Consumption. West US 2 is a Flex-supported region.
Provisioning commands (as run)
az group create -n rg-tokenbroker -l westus2
az storage account create -n sttokenbrokerexample -g rg-tokenbroker -l westus2 --sku Standard_LRS --allow-blob-public-access false
az keyvault create -n kv-tokenbroker-example -g rg-tokenbroker -l westus2 --enable-rbac-authorization true
az functionapp create -n tokenbroker-example -g rg-tokenbroker --consumption-plan-location westus2 --flexconsumption-location westus2 --runtime dotnet-isolated --runtime-version 11.0 --functions-version 4 --storage-account sttokenbrokerexample --assign-identity [system]
az role assignment create --assignee <app-principal> --role "Key Vault Secrets User" --scope <vault-resource-id>
az functionapp config appsettings set -n tokenbroker-example -g rg-tokenbroker --settings KeyVaultUri=https://kv-tokenbroker-example.vault.azure.net/ ZohoAccountsBase=https://accounts.zoho.com ZohoMailBase=https://mail.zoho.com
(The last command is history: configuration later moved into
appsettings.json / appsettings.Local.json and those app settings
were deleted, as described above.)
Deploy
From src/TokenBroker, with az, the .NET SDK, and func on PATH:
func azure functionapp publish tokenbroker-example --dotnet-isolated
A minimal local local.settings.json (gitignored) with
FUNCTIONS_WORKER_RUNTIME=dotnet-isolated must exist for runtime
detection; its values are not uploaded without
--publish-local-settings.
Verify after deploy: az functionapp function list shows
ZohoMailAccounts, ZohoMailSearch, ZohoMailRead, ZohoMailSend; an
unauthenticated call to /api/zoho/mail/accounts returns 401.
Gotchas worth the page
az keyvault secret setfails through this VM's egress proxy with HTTP 411 (Length Required). Write vault secrets from the VM through the REST API instead: get a token withaz account get-access-token --resource https://vault.azure.net, then PUT tohttps://kv-tokenbroker-example.vault.azure.net/secrets/<name>?api-version=7.4with curl. Reads through az work fine.- On Flex Consumption,
az functionapp keys listreturns the default key underfunctionKeys.default, nothostKeys.default. - Never push to this repo without the owner's go-ahead; commit locally and show what is ready.