Auto-Approve (Optional)

The bot can automatically approve elevation requests submitted outside configured business hours, granting a 4-hour approval. This requires Azure Key Vault to store the schedule securely.

Step 1 — Create the Key Vault

az keyvault create `

--name <vault-name> `

--resource-group <rg> `

--location <region> `

--enable-rbac-authorization true

Step 2 — Grant the Bot Access

If you are running the container locally, create a service principal and grant it the Key Vault Secrets Officer role:

$sp = az ad sp create-for-rbac --name "privman-bot-kv" --skipassignment | ConvertFrom-Json

$kv = az keyvault show --name <vault-name> --query id -o tsv

az role assignment create `

--role "Key Vault Secrets Officer" `

--assignee-object-id (az ad sp show --id $sp.appId --query id -o tsv) `

--assignee-principal-type ServicePrincipal `

--scope $kv

If you are hosting on Azure App Service or Container Apps, use a system-assigned managed identity instead and omit the AZURE_CLIENT_* variables. DefaultAzureCredential picks up the managed identity automatically.

Step 3 — Add Key Vault Variables to the Container

Add the following environment variables to your docker run command:

-e KEY_VAULT_URL=https://<vault-name>.vault.azure.net/ `

-e AZURE_CLIENT_ID=$sp.appId `

-e AZURE_CLIENT_SECRET=$sp.password `

-e AZURE_TENANT_ID=$sp.tenant

Step 4 — Configure the Schedule from Teams

In the Teams channel, send hello to get the welcome card, then either fill in the inline form or use the following text commands:

Command Description
autoapprove set mon-fri 08:00-17:00 America/Chicago Set business hours and timezone
autoapprove enable Turn on auto-approve
autoapprove disable Turn off auto-approve
autoapprove status Show the current schedule
autoapprove clear Remove the schedule entirely

Requests submitted within business hours are posted to Teams for manual approval. Requests submitted outside business hours are automatically approved for 4 hours and a notification card is posted to the channel.