Skip to content

This guide walks you through creating a Server Workload: Server Workloads represent target services, APIs, databases, or applications that receive and respond to access requests from Client Workloads.Learn more in Aembit to securely obtain OAuth tokens from Microsoft Entra ID (formerly Azure Active Directory) without storing static client secrets.

Use this Server Workload to enable your applications to authenticate to Entra ID-protected resources such as Microsoft Graph API, Azure services, or custom APIs secured by Entra ID.

Aembit supports two authentication approaches for Entra ID:

Before you begin, ensure you have the following:

  • Account access - Access to your Aembit Tenant: Aembit Tenants serve as isolated, dedicated environments within Aembit that provide complete separation of administrative domains and security configurations.Learn more (role: Workload Administrator or higher), and access to the Azure Portal with permissions to create Entra ID app registrations and federated credentials
  • Infrastructure - Aembit Edge: Aembit Edge represents components deployed within your operational environments that enforce Access Policies by intercepting traffic, verifying identities, and injecting credentials just-in-time.Learn more Components deployed in your environment:
    • Agent Proxy installed, through the Linux or Windows installation for VMs, or the Kubernetes deployment
    • TLS Decrypt configured on your Agent Proxy. Both authentication approaches require TLS Decrypt because the Agent Proxy must inspect HTTPS traffic to inject credentials. TLS decryption occurs only on the Agent Proxy running alongside your workload.
    • Network connectivity from your server to Entra ID endpoints (outbound HTTPS to login.microsoftonline.com)

Aembit provides two approaches for authenticating to Entra ID. The OAuth interception approach supports two credential provider types (JWT-SVID Token and OIDC ID Token).

AspectAzure Entra WIF CPJWT-SVID TokenOIDC ID Token
Best forNew integrations, direct Aembit managementExisting OAuth flows, zero code changesOIDC-based authentication
ComplexityHigher-level abstractionLower-level, more flexibleLower-level, OIDC standard
Scope configurationIn Credential ProviderIn application requestIn application request
Code changes requiredMay require SDK/config changesNone (intercepts existing requests)None (intercepts existing requests)
Credential Provider typeAzure Entra WIFJWT-SVID TokenOIDC ID Token

Choose Azure Entra WIF when:

  • You’re building a new integration from scratch
  • You want Aembit to manage the complete token exchange
  • You can configure your application to use Aembit’s credential flow

Choose OAuth interception (JWT-SVID Token or OIDC ID Token) when:

  • Your application already makes OAuth token requests to Entra ID
  • You need zero-code-change deployment
  • You want Aembit to intercept and secure existing OAuth flows

Use JWT-SVID Token if you want SPIFFE-compliant tokens, or OIDC ID Token if you prefer standard OpenID Connect tokens or want consistency across multiple cloud providers.

This approach uses the Azure Entra Workload Identity Federation (WIF) Credential Provider: Credential Providers obtain the specific access credentials—such as API keys, OAuth tokens, or temporary cloud credentials—that Client Workloads need to authenticate to Server Workloads.Learn more to directly obtain tokens from Entra ID. Aembit handles the complete token exchange, including federated credential validation.

Azure Entra Workload Identity Federation flow showing credential request from application through Aembit Cloud to Entra ID

Follow Configure an Azure Entra WIF Credential Provider, the complete setup guide for this Credential Provider type.

The guide covers:

  • Creating the Credential Provider in Aembit
  • Adding a federated credential in your Entra ID app registration
  • Configuring the OIDC issuer, audience, and subject mapping
  • Verifying the connection
  1. Log in to your Aembit Tenant.

  2. Go to Server Workloads, and click + New.

  3. Configure the following fields:

    • Name: Enter a descriptive name (for example, entra-id-graph-api)
    • Host: Enter the target API hostname (for example, graph.microsoft.com for Microsoft Graph)
    • Application Protocol: Select HTTP
    • Port: 443
    • Forward to Port: 443 with TLS enabled
    • Authentication method: Select HTTP Authentication
    • Authentication scheme: Select Bearer
  4. Click Save.

Create an Access Policy: Access Policies define, enforce, and audit access between Client and Server Workloads by cryptographically verifying workload identity and contextual factors rather than relying on static secrets.Learn more linking your Client Workload: Client Workloads represent software applications, scripts, or automated processes that initiate access requests to Server Workloads, operating autonomously without direct user interaction.Learn more, the Azure Entra WIF Credential Provider, and the Server Workload. See Access Policies for details.

This approach intercepts existing OAuth token requests from your application and replaces static credentials with dynamically generated tokens. Your application continues making standard OAuth requests without code changes.

Choose your credential provider type when you create the Credential Provider:

  • JWT-SVID Token - Uses JWT-SVID: A SPIFFE Verifiable Identity Document in JWT format. JWT-SVIDs are cryptographically signed, short-lived tokens that prove workload identity and enable secure authentication without static credentials.Learn more tokens based on the SPIFFE: Secure Production Identity Framework For Everyone (SPIFFE) is an open standard for workload identity that provides cryptographically verifiable identities to services without relying on shared secrets.Learn more(opens in new tab) standard
  • OIDC ID Token - Uses standard OpenID Connect tokens
OAuth interception flow showing Aembit Agent Proxy intercepting token requests between application and Entra ID
  1. Log in to the Azure Portal and go to Microsoft Entra ID -> App registrations.

  2. Click New registration or select an existing application.

  3. Note the following values from the Overview tab (you’ll need these when you create the Server Workload):

    • Application (client) ID
    • Directory (tenant) ID
  4. Assign API permissions required by your workload in API permissions.

  5. Go to Certificates & secrets -> Federated credentials tab.

  6. Click Add credential and configure the federated identity credential:

    FieldValue
    Federated credential scenarioOther issuer
    IssuerLeave this tab open - you’ll get this from Aembit when you create the Credential Provider
    Subject identifier typeExplicit subject identifier
    SubjectEnter the Subject value you planned (for example, spiffe://your-domain/workload/entra-client)
    Audienceapi://AzureADTokenExchange
  1. Open a new browser tab and log in to your Aembit Tenant.

  2. Go to Credential Providers and click + New.

  3. Configure the following fields:

    FieldValue
    NameDescriptive name (for example, entra-id-jwt-svid)
    Credential TypeJWT-SVID Token
    SubjectThe same Subject value you entered in Azure (for example, spiffe://your-domain/workload/entra-client)
    Audienceapi://AzureADTokenExchange
    Lifetime15 minutes (recommended)

    Shorter token lifetimes reduce the window for credential theft if an attacker steals a token. However, shorter lifetimes increase token refresh frequency, adding minor operational overhead. See Credential Lifecycle for guidance on choosing lifetimes based on your security requirements.

  4. Click Save. After saving, copy the OIDC Issuer URL displayed on the Credential Provider details page.

  5. Return to the Azure Portal tab you left open when you registered your application.

  6. Paste the OIDC Issuer URL into the Issuer field of your federated credential.

  7. Click Add to complete the federated credential setup in Azure Portal.

For detailed configuration options, see Create a JWT-SVID Token Credential Provider.

Use the Directory (tenant) ID you noted when you registered your application.

  1. Go to Server Workloads, and click + New.

  2. Configure the following fields:

    FieldValue
    NameDescriptive name (for example, entra-id-token-endpoint)
    Hostlogin.microsoftonline.com
    Application ProtocolOAuth
    Port443
    Forward to Port443 with TLS enabled
    URL Path/{tenant-id}/oauth2/v2.0/token - Replace {tenant-id} with your actual Directory ID (for example, /12345678-abcd-1234-efgh-123456789abc/oauth2/v2.0/token)
    AuthenticationOAuth Client Authentication (POST Body Form URL Encoded)
  3. Click Save.

Create an Access Policy linking your Client Workload, the JWT-SVID Token Credential Provider, and the Server Workload. See Access Policies for details.

Your application continues making standard OAuth requests. Aembit intercepts the request and replaces the client_secret with a client_assertion JWT-SVID. Test the interception with curl:

/user-guide/deploy-install/advanced-options/agent-proxy/explicit-steering
# Set proxy environment variables
export HTTP_PROXY=http://localhost:8080
export HTTPS_PROXY=http://localhost:8080
# Request OAuth token (replace placeholders with your values)
curl -X POST "https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id={client-id}" \
-d "client_secret=placeholder-value" \
-d "scope=https://graph.microsoft.com/.default"

A successful request returns an access token:

{
"token_type": "Bearer",
"expires_in": 3599,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJS..."
}

If your application uses Azure.Identity or Microsoft Authentication Library (MSAL) SDK, configure it to use client credentials with a placeholder secret. The Agent Proxy intercepts token requests from these SDKs and injects real credentials.

For SDK-specific code examples and official documentation links, see Service-specific SDK resources.

The scope determines which API permissions your application can access:

Azure APIScope
Microsoft Graphhttps://graph.microsoft.com/.default
Azure Resource Managerhttps://management.azure.com/.default
Azure Key Vaulthttps://vault.azure.net/.default
Azure Storagehttps://storage.azure.com/.default
Custom APIapi://{Application-ID}/.default

Choosing the right scope

The scope you configure determines which API permissions your application can access. Choose based on your security posture and operational requirements:

Scope PatternSecurity LevelUse When
.defaultLower (grants all defined permissions)Testing, rapid development
Specific permissionHigher (grants only requested permission)Production with defined requirements
Multiple specific permissionsHighest (explicit, granular control)High-security environments

Choose the scope by environment:

  • Development and test - Use .default for faster iteration
  • Production - Use specific permission scopes following the least-privilege principle

The following table shows recommended scopes for common scenarios:

ScenarioRecommended Scope
Local development.default
Production API (read-only)api://{AppID}/Data.Read
Production API (read/write)api://{AppID}/Data.Read api://{AppID}/Data.Write
Financial servicesSeparate Server Workloads per permission

For more on Entra ID permission scopes, see Microsoft Entra ID permissions and consent.

Aembit dynamically generates short-lived credentials, eliminating manual rotation. For details on credential rotation, compromise response, and audit logging, see Credential Lifecycle Management.

For common issues like Agent Proxy connectivity, network problems, or TLS configuration, see the Troubleshooting Guide.

When token exchange fails, check the Agent Proxy logs to see what credentials Aembit is injecting.

Linux (systemd)
# Monitor Agent Proxy logs for credential events
sudo journalctl --namespace aembit_agent_proxy | grep -i "credential"
# View recent logs with timestamps
sudo journalctl --namespace aembit_agent_proxy --since "5 minutes ago"
Docker and Kubernetes
# Find the Agent Proxy pod
kubectl get pods -n <namespace> | grep agent-proxy
# View Agent Proxy logs (standalone deployment)
kubectl logs <agent-proxy-pod> -n <namespace> -f
# If using sidecar injection
kubectl logs <pod> -n <namespace> -c aembit-agent-proxy -f

In the logs, look for:

  • Successful token exchange - Log entries referencing credential injection or GetCredentials calls
  • Failed token exchange - Error messages about missing Access Policies, invalid credentials, or network failures

To enable more detailed logging, see Changing Agent log levels.

This section covers Entra ID-specific issues:

Application with identifier wasn’t found

Section titled “Application with identifier wasn’t found”

The token request returns AADSTS700016: Application with identifier '{client-id}' wasn't found, because the Application (client) ID in your Server Workload or Credential Provider doesn’t match an Entra ID app registration.

To resolve the error:

  1. Verify the Application (client) ID in Azure Portal: Microsoft Entra ID -> App registrations -> Overview
  2. Update the Client ID in your Aembit Server Workload or Credential Provider configuration
  3. Ensure the app registration exists in the correct Azure tenant

The token request succeeds, but your application receives 401 Unauthorized or 403 Forbidden errors.

To diagnose the failure:

  • Check Entra ID sign-in logs: Microsoft Entra ID -> Sign-in logs -> Filter by Client ID
  • Verify API permissions: App registrations -> Your app -> API permissions

To resolve the errors:

  • Add missing API permissions in Entra ID
  • Click Grant administrator consent if permissions require it
  • Verify the scope in your request matches configured permissions

The OAuth token request returns an error or times out.

Test network connectivity to isolate the failure:

Terminal window
# Test network connectivity to Entra ID
curl -I "https://login.microsoftonline.com"
# Test through Agent Proxy
# Only required for explicit steering: /user-guide/deploy-install/advanced-options/agent-proxy/explicit-steering
export HTTPS_PROXY=http://localhost:8080
curl -I "https://login.microsoftonline.com"

To resolve the failure:

  • Verify firewall rules allow outbound HTTPS to login.microsoftonline.com
  • Confirm you configured TLS Decrypt
  • Check Agent Proxy logs for errors

The token request returns AADSTS70021: No matching federated identity record found, because the OIDC issuer, subject, or audience in the Entra ID federated credential doesn’t match the Aembit Credential Provider configuration.

To resolve the mismatch:

  1. In Aembit, note the exact values for:
    • OIDC Issuer URL
    • Subject
    • Audience (should be api://AzureADTokenExchange)
  2. In Azure Portal, verify the federated credential matches exactly:
    • Microsoft Entra ID -> App registrations -> Your app -> Certificates & secrets -> Federated credentials
  3. Update any mismatched values
Remove the Entra ID Server Workload

If you no longer need this integration, remove components in this order:

  1. Deactivate associated Access Policies. Go to Access Policies, find the Access Policies that use this Server Workload or Credential Provider, and toggle each one off.

  2. Delete the Server Workload. Go to Server Workloads, select your Entra ID workload, and click Delete.

  3. Delete the Credential Provider. Go to Credential Providers, select the associated Credential Provider, and click Delete.

  4. Optionally, delete the Entra ID app registration in Azure Portal: Microsoft Entra ID -> App registrations -> Select application -> Delete.

Deleting the Server Workload immediately stops credential provisioning. Ensure no applications are actively using this workload before deletion.