ExAzureCore.Auth.ManagedIdentity.AppServiceProvider (ex_azure_core v0.2.0)

Copy Markdown

App Service provider for Azure Managed Identity.

Fetches tokens from the Azure App Service identity endpoint for App Service, Functions, and Logic Apps workloads.

Environment Variables

The following environment variables must be set by Azure:

  • IDENTITY_ENDPOINT - The identity endpoint URL
  • IDENTITY_HEADER - Secret header value for authentication

Configuration

  • :resource (required) - The Azure resource URI
  • :client_id (optional) - Client ID for user-assigned managed identity

Summary

Functions

Fetches an access token from Azure App Service identity endpoint.

Types

config()

@type config() :: %{
  :resource => String.t(),
  optional(:client_id) => String.t(),
  optional(:timeout) => non_neg_integer()
}

Functions

fetch_token(config)

@spec fetch_token(config()) :: {:ok, map()} | {:error, term()}

Fetches an access token from Azure App Service identity endpoint.

Configuration

  • :resource (required) - The Azure resource URI
  • :client_id (optional) - Client ID for user-assigned managed identity
  • :timeout (optional) - Request timeout in milliseconds (default: 5000)

Examples

{:ok, token} = AppServiceProvider.fetch_token(%{
  resource: "https://management.azure.com/"
})