Quick Start: Set Up a Custom Domain
Replace the default *.azurecontainerapps.io hostname with your own domain (for example, app.contoso.com) and update the StratoLens settings that depend on it.
What this guide covers
Binding the custom domain and certificate to the Container App is a standard Azure step. We won't repeat it here. Use Microsoft's docs for that part:
- Free managed certificate (recommended): Azure issues and renews the cert for you.
- Bring your own certificate: if you already have one or need a wildcard / EV cert.
Once Microsoft's steps are complete, the Custom domains blade on your Container App should show your hostname bound with a valid certificate:
With the domain bound, StratoLens needs four updates so authentication and email links use the new hostname:
- Add the new URL to the main App Registration (SPA redirect URIs).
- Add the new email callback URL to the Notifications App Registration (Web redirect URIs).
- Update
WEBSITE_HOSTNAMEon the StratoLens Container App. - Update
WEBSITE_HOSTNAMEon the StratoLens Container App Job.
Keep the original URL during cutover
Don't remove the original *.azurecontainerapps.io redirect URI right away. Leaving it in place gives you a working fallback if anything goes wrong during the switch.
1Add the new URL to the main App Registration
In the Azure Portal, go to Microsoft Entra ID → App registrations. Switch the filter at the top to All applications and search for StratoLens. You should see two app registrations:
- StratoLens: the main app registration (used in this step).
- StratoLens Notifications: the email-sending app registration (used in step 2).
Open the StratoLens app registration. Then:
- Click Authentication in the left sidebar.
- Find the Single-page application row and click Edit.
- In the box that appears, add your custom URL on a new line below the existing
*.azurecontainerapps.ioURI, for examplehttps://app.contoso.com(replace with your domain). - Click Configure at the bottom right of the page to save.
Leave the existing https://ca-{company}-stratolens.{region}.azurecontainerapps.io entry in place for now.
It must be the SPA section, not Web
The main StratoLens app registration uses the Single-page application redirect type.
2Add the email callback URL to the Notifications App Registration
Go back to App registrations and open the StratoLens Notifications app registration. Then:
- Click Authentication in the left sidebar.
- Find the Web row (not Single-page application this time) and click Edit.
- In the box that appears, add your custom email callback URL on a new line below the existing
*.azurecontainerapps.io/auth/email-callbackURI, for examplehttps://app.contoso.com/auth/email-callback(replace with your domain). - Click Configure at the bottom right of the page to save.
/auth/email-callback URL on the new domain below the existing one.Web, not SPA: this one's different
The Notifications app registration uses the Web redirect type.
3Update WEBSITE_HOSTNAME on the Container App
StratoLens reads the WEBSITE_HOSTNAMEenvironment variable to build the auth redirect URI it sends to Microsoft Entra and the "View in StratoLens" deep links in emails. It needs to match your new domain.
Use the Azure CLI, not the Portal
The Azure Portal can't save environment-variable changes on the StratoLens Container App and Container App Job because of how it handles their container registry configuration. Use the Azure CLI commands below instead. They work as-is in either Bash or PowerShell. The easiest place to run them is Azure Cloud Shell, which is already signed in to your tenant. A local terminal with the Azure CLI installed and az login run also works.
Copy the command below and replace the placeholders before running it:
<RESOURCE_GROUP>: the resource group StratoLens is deployed into (shown on the Container App's Overview page).<COMPANY>: the company name used in your Container App name,ca-{company}-stratolens.<YOUR_HOSTNAME>: your custom hostname, for exampleapp.contoso.com. Hostname only, nohttps://.
az containerapp update --resource-group <RESOURCE_GROUP> --name ca-<COMPANY>-stratolens --set-env-vars WEBSITE_HOSTNAME=<YOUR_HOSTNAME>The command creates a new revision of the Container App, which picks up the updated value.
To confirm the change was applied, open the Container App ca-{company}-stratolens in the Azure Portal, click Containers in the left sidebar, then the Environment variables tab. WEBSITE_HOSTNAMEshould show your custom hostname. Use the Portal to check the value only; don't edit or save it there.
ca-{company}-stratolens → Containers → Environment variables. WEBSITE_HOSTNAME should show your custom hostname.4Update WEBSITE_HOSTNAME on the Container App Job
Scheduled reports and background notifications are sent by a separate Container App Job named job-{company}-stratolens. It needs the same update so the deep links in scheduled emails point at the new domain.
Run the command below with the same placeholder values you used in step 3. <YOUR_HOSTNAME> must match the hostname from step 3 exactly.
az containerapp job update --resource-group <RESOURCE_GROUP> --name job-<COMPANY>-stratolens --set-env-vars WEBSITE_HOSTNAME=<YOUR_HOSTNAME>The next scheduled run of the job uses the new value.
To confirm the change was applied, open the Container App Job job-{company}-stratolens in the Azure Portal, click Containers in the left sidebar, click the container name Scheduler, then the Environment variables tab. WEBSITE_HOSTNAMEshould match the hostname from step 3. Again, check the value only; don't edit or save it in the Portal.
job-{company}-stratolens → Containers → Environment variables. WEBSITE_HOSTNAME should match the hostname from step 3.Don't skip the job
If you only update the Container App, scheduled report emails will keep linking to the old *.azurecontainerapps.io URL. The job runs on its own revision and reads its own environment variables.
5Verify
Once both revisions are running, confirm the switch worked:
- Sign-in: open
https://app.contoso.comin a new browser session and sign in. You should land in StratoLens without a redirect-URI error. - Email OAuth: go to Settings → Email Notifications, run the OAuth connect flow, and confirm it completes without an
AADSTS50011redirect-mismatch error. - Email links:trigger a test notification or scheduled report and verify the "View in StratoLens" button in the email points at the new hostname.
You're on your custom domain
Sign-in, email OAuth, and email deep links are all using the new hostname. Once you've confirmed everything works, you can remove the original *.azurecontainerapps.io redirect URI from both app registrations.