Extension for Azure Pipelines offering tasks to build and publish custom Azure AD B2C policies.
This extension contains two Azure Pipelines tasks:
The build task expects the settings format used with the
Azure AD B2C Visual Studio Code extension.
An example appsettings.json file could look like this:
{
"Environments": [
{
"Name": "Production",
"Production": true,
"Tenant": "yourb2ctenant.onmicrosoft.com",
"PolicySettings": {
"ProxyIdentityExperienceFrameworkAppId": "c74d6563-ac03-4b08-9314-688cb1e9a8e0",
"IdentityExperienceFrameworkAppId": "00fda17e-690e-47b6-9614-739556e731c3"
}
}
]
}
The policy XML files (located in the same folder) can utilize placeholders that are replaced by the build task:
<TrustFrameworkPolicy TenantId="{Settings:Tenant}">
</TrustFrameworkPolicy>
Or:
<Item Key="client_id">{Settings:ProxyIdentityExperienceFrameworkAppId}</Item>
Usage example in YAML:
- task: b2c-policy-build@1
displayName: Build policies
inputs:
environment: "Production"
inputFolder: "$(Build.Repository.LocalPath)/Policies"
outputFolder: "$(Build.ArtifactStagingDirectory)/policies"
additionalArguments: |
ApiUrl=https://test.com
SecondSetting=$(SecondSetting)
Three parameters are required:
The fourth parameter additionalArguments
, is optional.
It allows you to override settings in appsettings.json, or add ones that are missing from there.
You could for example use pipeline variables.
There is an example above of its usage; you specify one setting per line in the format Key=Value
.
The publish task takes policy XML files that are ready to publish and uploads them to your Azure AD B2C tenant.
It looks at the policies’ base policies to publish the base policies first before the policies that require them.
To publish policies, you need to first create an app registration in the Azure AD B2C tenant.
The app registration is now ready, and you should have the tenant id, client id and client secret.
Usage example in YAML:
- task: b2c-policy-publish@1
displayName: Publish policies
inputs:
inputFolder: "$(Build.ArtifactStagingDirectory)/policies"
authority: "https://login.microsoftonline.com/your-tenant-id-here"
clientId: "your-client-id-here"
clientSecret: "$(ClientSecret)"
Four parameters are required:
https://login.microsoftonline.com/your-tenant-id-here