End-to-end steps for deploying SonWinCommonAPI to Azure: Entra ID app registrations, App Service setup, networking, and a Postman verify.
Entra ID → App registrations → New registration
SonWinCommonAPINote the Application (client) ID and Directory (tenant) ID — they go into the App Service env vars (§4).
Expose an API:
api://<client-id>)App roles → Create app role:
AccessAccessFor each app that needs to call SonWinCommonAPI (e.g. egu-common-api):
Entra ID → App registrations → New registration
egu-common-apiCertificates & secrets → New client secret — copy the value immediately
API permissions → Add a permission → APIs my organization uses → SonWinCommonAPI
Access app roleClick Grant admin consent for <tenant>
In the Azure Portal, create a new Web App:
In App Service → Settings → Environment variables:
Connection strings tab:
| Name | Value | Type |
|---|---|---|
SonWinDb | Server=<private-ip>;Database=<db>;User Id=<user>;Password=<password>;TrustServerCertificate=True; | SQLServer |
Use the VM's private IP, not the public IP.
Application settings tab:
| Name | Value |
|---|---|
AzureAd__TenantId | <tenant-id> |
AzureAd__ClientId | <SonWinCommonAPI-client-id> |
These tell the API which tenant issued tokens must come from and which audience (aud claim) to accept. The calling app keeps its own config (client ID, secret, target scope api://<SonWinCommonAPI-client-id>/.default, tenant ID) on its side.
In App Service → Settings → Networking → VNet Integration:
appservice-subnet (or similar)On the VM's Network Security Group, find the existing inbound rule for port 1433 and update the Source to include the IP range of appservice-subnet:
appservice-subnet (found in Virtual Network → Subnets → appservice-subnet)In Postman, under Authorization → OAuth 2.0 → Get New Access Token:
https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/tokenegu-common-api's client IDegu-common-api's secretapi://<SonWinCommonAPI-client-id>/.defaultClick Get New Access Token, then call an endpoint with it:
GET https://<app-service-url>/bright/accounts
Authorization: Bearer <token>
To test connectivity from the App Service to SQL Server, use the console (App Service → Development Tools → Console):
tcpping <private-ip>:1433