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.shscript 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:
- The Guardrails backend assumes the WIF transit role. A dedicated, short-lived session on a single IAM role:
{prefix}_wif_{region}. - The backend calls
sts:GetWebIdentityTokenon the assumed role with the Azure audience. AWS STS returns a signed OIDC JWT withiss,sub, andaudclaims. - The backend calls Microsoft Entra ID with the JWT as the
clientAssertionon theclient_credentialsgrant. Entra ID validates the JWT against your federated identity credential. - 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:
- No long-lived credentials: nothing to store in Guardrails policy, nothing to rotate, nothing that can leak.
- Cryptographic identity chain: the trust is anchored to the specific AWS account and IAM role that Guardrails runs as.
- Audit trail in CloudTrail: every federation event is logged as an
sts:GetWebIdentityTokencall with the worker's role session name.
Where Resources Live
Understanding which resources belong where helps with setup and troubleshooting.
In the Guardrails AWS account:
| Resource | Purpose |
|---|---|
{prefix}_wif_{region} IAM role | Dedicated transit role for Azure WIF. Only worker and API roles can assume it. |
sts:GetWebIdentityToken inline policy on that role | Allows the role to mint signed OIDC JWTs scoped to the three Azure audiences. |
/{prefix}/enterprise/azure_wif_issuer_url SSM parameter | Stores 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:
| Resource | Purpose |
|---|---|
| App Registration | The identity Guardrails uses against Azure APIs. |
| Federated Identity Credential | Tells Entra ID to trust JWTs from the Guardrails AWS account where iss, sub, and aud match. |
In your Azure subscriptions or management group:
| Resource | Purpose |
|---|---|
| Reader RBAC role assignment | Lets the App Registration enumerate and read resources. |
| Microsoft Graph application permissions | Directory.Read.All, Policy.Read.All, AccessReview.Read.All, required for the AAD / Entra controls in tenant imports. |
Prerequisites
- The Guardrails workspace has Azure WIF enabled. The Turbot Enterprise Foundation (TEF) stack has the
sts:GetWebIdentityTokenpolicy on its WIF transit role, and the/{prefix}/enterprise/azure_wif_issuer_urlSSM parameter exists. New deployments get this automatically; older deployments need a TEF stack update. Confirm with your Guardrails administrator. - An Azure App Registration in the target tenant. If you don't have one, follow the Creating a Guardrails App Registration section of App Registration Setup. For WIF you can skip the Client Secret, API Permissions, and IAM Permissions sections on that page. The setup script in the steps below handles all three. Have the Tenant ID and Client ID (Application ID) handy.
- For SaaS customers, Turbot has enabled AWS IAM Outbound Identity Federation on the SaaS AWS account and seeded the SSM parameter. You don't need to do anything AWS-side. Skip Step 4.
- For Enterprise (self-hosted) customers, AWS CLI access to the Guardrails AWS master account with permission to call
iam:EnableOutboundWebIdentityFederation,iam:GetOutboundWebIdentityFederationInfo, andssm:PutParameteron/{prefix}/enterprise/*. - Permission in Microsoft Entra ID to create a federated identity credential on the App Registration:
Application Administrator,Cloud Application Administrator, or App Registration owner. - Permission in Azure RBAC to assign
Readerat the tenant root scope:User Access AdministratororOwnerat that scope. - The
azCLI installed and authenticated (az login) against the target tenant.
[!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:
| Field | Value |
|---|---|
| Issuer | The 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. |
| Audience | api://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.
| Permission | Purpose |
|---|---|
Directory.Read.All | Read directory objects (users, groups, applications). |
Policy.Read.All | Read Conditional Access policies and other Entra ID policies. |
AccessReview.Read.All | Read 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:
- Navigate to Management groups and select the Tenant Root Group.
- Click Access control (IAM) > Add > Add role assignment.
- Select the Reader role.
- Search for your App Registration by name and select it.
- 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-federationcalls. 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.
- From the Dashboard, select CONNECT (or from Workspace > Accounts, select Import), then choose Azure > Azure Tenant.
- Confirm Workload Identity Federation is selected as the access mode.
- Enter your Tenant ID and Client ID from your App Registration (see Prerequisites).
- Click Discover Tenant. Guardrails performs the WIF round-trip and enumerates your management groups and subscriptions.
- 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.
| Scope | Required Azure RBAC | Microsoft Graph |
|---|---|---|
| Tenant root management group | Reader | Directory.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 Environment | Authority URL | Federated Credential Audience |
|---|---|---|
| Global Cloud | login.microsoftonline.com | api://AzureADTokenExchange |
| US Government | login.microsoftonline.us | api://AzureADTokenExchangeUSGov |
| China (21Vianet) | login.partner.microsoftonline.cn | api://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:
| Issue | Resolution |
|---|---|
| WIF option is greyed out in the wizard | The 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 script | The 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 subscriptions | RBAC 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
| Issue | Resolution |
|---|---|
| Discover Tenant fails consistently on SaaS | Turbot 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 import | The 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 assistance | Open a Support Ticket. |
Next Step
Proceed to Connect using Workload Identity Federation to run the Guardrails import wizard.
Further Reading
- Microsoft Entra ID: Workload Identity Federation, Microsoft's documentation on federated identity credentials.
- AWS IAM: Outbound Identity Federation, AWS user guide for the issuer feature.
- Azure CLI:
az ad app federated-credential.