End-to-end steps for deploying SonWinCommonAPI to Azure: Entra ID app registrations, App Service setup, networking, and a Postman verify.

Prerequisites

1. Register SonWinCommonAPI in Entra ID

  1. Entra ID → App registrations → New registration

  2. Note the Application (client) ID and Directory (tenant) ID — they go into the App Service env vars (§4).

  3. Expose an API:

  4. App roles → Create app role:

2. Register the calling app in Entra ID

For each app that needs to call SonWinCommonAPI (e.g. egu-common-api):

  1. Entra ID → App registrations → New registration

  2. Certificates & secrets → New client secret — copy the value immediately

  3. API permissions → Add a permission → APIs my organization uses → SonWinCommonAPI

  4. Click Grant admin consent for <tenant>

3. Create the Web App

In the Azure Portal, create a new Web App:

4. Configure environment variables

In App Service → Settings → Environment variables:

Connection strings tab:

NameValueType
SonWinDbServer=<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:

NameValue
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.

5. VNet integration

In App Service → Settings → Networking → VNet Integration:

  1. Select the same VNet as the VM
  2. The default subnet cannot be shared — create a new subnet in the VNet first:
  3. Select the new subnet in VNet Integration

6. NSG rule for SQL Server

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:

7. Deploy from Visual Studio

  1. Right-click the project → Publish, or use Build → Publish
  2. Select Azure App Service
  3. Options:
  4. Click Publish

8. Verify with Postman

In Postman, under Authorization → OAuth 2.0 → Get New Access Token:

Click 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