Set Up Workload Identity Federation

In this guide, you will set up Azure Workload Identity Federation (WIF) so Guardrails can authenticate to your Azure tenant without a client secret. You will create an App Registration, federate Guardrails' AWS IAM identity to it via Microsoft Entra ID's federated identity credential feature, grant Microsoft Graph application permissions, and grant Reader RBAC at the tenant root management group.

[!TIP] The Guardrails import wizard generates a setup-azure-wif.sh script that performs Steps 1 – 3 of this guide automatically (the federated identity credential, the Microsoft Graph permissions, and the tenant-root Reader RBAC). Most users should just create the App Registration (see Prerequisites below), then jump straight to Connect using Workload Identity Federation and let the wizard handle the rest. Use the full manual procedure below only if you need fine-grained control or are setting up WIF outside the wizard.

How It Works

When Guardrails needs to talk to Azure, four steps happen behind the scenes:

  1. The Guardrails backend assumes the WIF transit role. A dedicated, short-lived session on a single IAM role: {prefix}_wif_{region}.
  2. The backend calls sts:GetWebIdentityToken on the assumed role with the Azure audience. AWS STS returns a signed OIDC JWT with iss, sub, and aud claims.
  3. The backend calls Microsoft Entra ID with the JWT as the clientAssertion on the client_credentials grant. Entra ID validates the JWT against your federated identity credential.
  4. Entra ID returns an access token for your App Registration. The token is cached so repeated calls hit the cache instead of round-tripping back to Entra ID.

The benefits over a client secret:

Where Resources Live

Understanding which resources belong where helps with setup and troubleshooting.

In the Guardrails AWS account:

ResourcePurpose
{prefix}_wif_{region} IAM roleDedicated transit role for Azure WIF. Only worker and API roles can assume it.
sts:GetWebIdentityToken inline policy on that roleAllows the role to mint signed OIDC JWTs scoped to the three Azure audiences.
/{prefix}/enterprise/azure_wif_issuer_url SSM parameterStores the AWS account's OIDC issuer URL. Guardrails reads it at wizard time.
AWS IAM Outbound Identity Federation (account-level)Enabled once per AWS account. Generates the issuer URL.

In your Microsoft Entra ID tenant:

ResourcePurpose
App RegistrationThe identity Guardrails uses against Azure APIs.
Federated Identity CredentialTells Entra ID to trust JWTs from the Guardrails AWS account where iss, sub, and aud match.

In your Azure subscriptions or management group:

ResourcePurpose
Reader RBAC role assignmentLets the App Registration enumerate and read resources.
Microsoft Graph application permissionsDirectory.Read.All, Policy.Read.All, AccessReview.Read.All, required for the AAD / Entra controls in tenant imports.

Prerequisites

[!NOTE] The Guardrails import wizard auto-populates the AWS Account ID, WIF transit role ARN, and (for Enterprise customers, after the AWS Setup Script runs) the OIDC Issuer URL. You do not need to look these up manually.

Step 1: Create a Federated Identity Credential

Add a federated identity credential to the App Registration that trusts the Guardrails AWS account's OIDC issuer for the WIF transit role and Azure audience.

The credential's three fields are:

FieldValue
IssuerThe OIDC issuer URL from the Guardrails AWS account. SaaS: provided by Turbot. Enterprise: produced by the AWS Setup Script in Step 4.
Subject{prefix}_wif_{region}, the ARN of the Guardrails WIF transit role. The wizard shows the exact value.
Audienceapi://AzureADTokenExchange (Global Cloud). See Sovereign Cloud Support for Gov / China audiences.

Using the az CLI:

az ad app federated-credential create --id <APP_REGISTRATION_OBJECT_ID> --parameters '{
  "name": "turbot-guardrails-wif",
  "issuer": "<GUARDRAILS_AWS_OIDC_ISSUER_URL>",
  "subject": "<GUARDRAILS_WIF_ROLE_ARN>",
  "audiences": ["api://AzureADTokenExchange"]
}'

This step also requires a Service Principal for the App Registration. If one doesn't exist, the wizard's setup script creates it. To do this manually: az ad sp create --id <APP_ID>.

Step 2: Grant Microsoft Graph API Permissions

Grant the App Registration the Microsoft Graph application permissions Guardrails needs to read AAD / Entra ID data for tenant imports, then grant admin consent.

PermissionPurpose
Directory.Read.AllRead directory objects (users, groups, applications).
Policy.Read.AllRead Conditional Access policies and other Entra ID policies.
AccessReview.Read.AllRead Entra ID access reviews.

Using the az CLI:

APP_ID="<your appId>"
GRAPH_API="00000003-0000-0000-c000-000000000000"

# Add each permission (role assignment type)
az ad app permission add --id $APP_ID --api $GRAPH_API \
  --api-permissions 7ab1d382-f21e-4acd-a863-ba3e13f7da61=Role  # Directory.Read.All
az ad app permission add --id $APP_ID --api $GRAPH_API \
  --api-permissions 246dd0d5-5bd0-4def-940b-0421030a5b68=Role  # Policy.Read.All
az ad app permission add --id $APP_ID --api $GRAPH_API \
  --api-permissions d07a8cc0-3d51-4b77-b3b0-32704d1f69fa=Role  # AccessReview.Read.All

# Grant admin consent
az ad app permission admin-consent --id $APP_ID

Step 3: Grant Reader RBAC at the Tenant Root

Assign the Reader role to the App Registration at the tenant root management group. This lets the App Registration enumerate and read resources across all subscriptions in the tenant.

Using the Azure Portal:

  1. Navigate to Management groups and select the Tenant Root Group.
  2. Click Access control (IAM) > Add > Add role assignment.
  3. Select the Reader role.
  4. Search for your App Registration by name and select it.
  5. Click Review + assign.

Using the az CLI:

TENANT_ID="<your tenant id>"
APP_ID="<your appId>"

az role assignment create \
  --assignee "$APP_ID" \
  --role "Reader" \
  --scope "/providers/Microsoft.Management/managementGroups/$TENANT_ID"

For full governance (auto-remediation, runtime controls), grant Contributor or Owner instead of Reader. See App Registration Setup: Which Azure IAM Permissions to Grant.

Step 4: (Enterprise Only) Set Up AWS Outbound Federation

[!NOTE] SaaS customers skip this step. Turbot has already enabled outbound federation on the SaaS AWS account and seeded the SSM parameter. Proceed to Run the Import Wizard.

Enterprise (self-hosted) customers run this step once per Guardrails AWS account to enable AWS to mint OIDC JWTs and to record the issuer URL where Guardrails reads it.

# 1. Enable AWS outbound web identity federation on the account.
aws iam enable-outbound-web-identity-federation

# 2. Fetch the OIDC IssuerIdentifier URL minted by AWS.
ISSUER_URL=$(aws iam get-outbound-web-identity-federation-info --query 'IssuerIdentifier' --output text)
echo "$ISSUER_URL"

# 3. Write the issuer URL to SSM where the Guardrails backend reads it.
aws ssm put-parameter \
  --name "/{prefix}/enterprise/azure_wif_issuer_url" \
  --value "$ISSUER_URL" \
  --type "SecureString" \
  --overwrite

Replace {prefix} with your Guardrails installation prefix.

[!IMPORTANT] Run this step once per AWS account. AWS rejects repeated enable-outbound-web-identity-federation calls. If you ever need to disable and re-enable outbound federation, treat it as a destructive operation: the issuer URL AWS generates may change, which would break every federated identity credential that trusts the old URL.

Run the Import Wizard

With Steps 1 – 3 complete (and Step 4 for Enterprise), open the Guardrails wizard and complete the import.

  1. From the Dashboard, select CONNECT (or from Workspace > Accounts, select Import), then choose Azure > Azure Tenant.
  2. Confirm Workload Identity Federation is selected as the access mode.
  3. Enter your Tenant ID and Client ID from your App Registration (see Prerequisites).
  4. Click Discover Tenant. Guardrails performs the WIF round-trip and enumerates your management groups and subscriptions.
  5. Continue through Discovery Levels, Destination Folder, and Review to complete the import.

See Connect using Workload Identity Federation for the full wizard walkthrough.

Permissions Reference

The Azure RBAC role assignment depends on the scope you want Guardrails to govern. WIF doesn't change the RBAC model. The same roles you'd grant to a client-secret App Registration apply.

ScopeRequired Azure RBACMicrosoft Graph
Tenant root management groupReaderDirectory.Read.All, Policy.Read.All, AccessReview.Read.All (granted in Step 2)

For full governance (auto-remediation, runtime controls), grant Contributor or Owner instead of Reader at the tenant root management group.

Sovereign Cloud Support

Azure WIF works in all three Azure clouds. The federated credential audiences value differs by cloud:

Azure EnvironmentAuthority URLFederated Credential Audience
Global Cloudlogin.microsoftonline.comapi://AzureADTokenExchange
US Governmentlogin.microsoftonline.usapi://AzureADTokenExchangeUSGov
China (21Vianet)login.partner.microsoftonline.cnapi://AzureADTokenExchangeChina

The wizard fills in the correct audience based on the Azure Environment you select in the credentials step. If you're configuring the credential manually in Step 1, use the value matching your cloud.

[!CAUTION] Cross-cloud access is not supported. The Azure App Registration must be in the same cloud as the Azure resources you want to govern.

Troubleshooting

The most common failures:

IssueResolution
WIF option is greyed out in the wizardThe Guardrails deployment doesn't have the WIF transit role configured. Ask your administrator to update the TEF stack.
Discover Tenant fails on Enterprise after running the Azure scriptThe AWS-side setup may not have been completed. Verify the SSM parameter exists with aws ssm get-parameter --name "/{prefix}/enterprise/azure_wif_issuer_url". If missing, complete Step 4.
Discover Tenant fails: "AADSTS70021: No matching federated identity record"The federated credential issuer, subject, or audiences don't match the wizard values. Re-create the credential with the exact values the wizard shows.
Discovery finds zero subscriptionsRBAC was granted at the wrong scope, or it hasn't propagated yet. Wait 1–2 minutes. Verify with az role assignment list --assignee <CLIENT_ID> --all.

Less Common Issues

IssueResolution
Discover Tenant fails consistently on SaaSTurbot may not have enabled outbound federation on the SaaS account. Open a Support Ticket.
Federated credential creation fails: "Insufficient privileges"The Azure CLI session does not have Application Administrator, Cloud Application Administrator, or App Registration owner rights.
Role assignment fails: "Authorization failed"The signed-in user does not have User Access Administrator or Owner at the target scope.
Discover Tenant fails: "AADSTS500011: Resource principal was not found"The App Registration exists but no Reader RBAC has been granted at the import scope. Re-run Step 3.
Controls in error after importThe Guardrails backend isn't running Azure-WIF-capable code. Confirm with your administrator that the deployment is on a version that supports Azure WIF.
Further assistanceOpen a Support Ticket.

Next Step

Proceed to Connect using Workload Identity Federation to run the Guardrails import wizard.

Further Reading