Skip to content

Commit 35016b1

Browse files
authored
Merge branch 'master' into laura-batch-job-prep
2 parents 8925644 + 129840c commit 35016b1

File tree

916 files changed

+16787
-14581
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

916 files changed

+16787
-14581
lines changed

.openpublishing.redirection.json

Lines changed: 264 additions & 14 deletions
Large diffs are not rendered by default.

articles/active-directory-b2c/TOC.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@
8181
- name: Register a SAML service provider
8282
href: connect-with-saml-service-providers.md
8383
displayName: SP, RP, service provider, connect
84+
- name: Register a Graph application
85+
href: microsoft-graph-get-started.md
86+
displayName: migrate, migration, microsoft graph
8487
- name: Add a web API application
8588
href: add-web-application.md
8689
- name: Add a native client application
@@ -351,6 +354,12 @@
351354
href: view-usage-reports.md
352355
- name: Account management
353356
href: manage-user-accounts-graph-api.md
357+
- name: Deploy with Azure Pipelines
358+
href: deploy-custom-policies-devops.md
359+
displayName: azure devops, ci/cd, cicd, custom policy, policies
360+
- name: Manage policies with PowerShell
361+
href: manage-custom-policies-powershell.md
362+
displayName: scripting, scripts, psh, custom policy
354363
- name: Audit logs
355364
href: view-audit-logs.md
356365
- name: Manage users - Azure portal
@@ -371,8 +380,6 @@
371380
items:
372381
- name: Migrate users
373382
href: user-migration.md
374-
- name: Migrate users with external identities
375-
href: migrate-social-identities.md
376383
- name: Reference
377384
items:
378385
- name: Identity Experience Framework release notes
@@ -386,9 +393,11 @@
386393
displayName: cookies, SameSite
387394
- name: Error codes
388395
href: error-codes.md
396+
- name: Microsoft Graph API operations
397+
href: microsoft-graph-operations.md
389398
- name: Region availability & data residency
390399
href: data-residency.md
391-
- name: Enable billing
400+
- name: Billing model
392401
href: billing.md
393402
- name: Threat management
394403
href: threat-management.md

articles/active-directory-b2c/application-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ To set up client credential flow, see [Azure Active Directory v2.0 and the OAuth
121121

122122
#### Web API chains (on-behalf-of flow)
123123

124-
Many architectures include a web API that needs to call another downstream web API, where both are secured by Azure AD B2C. This scenario is common in native clients that have a Web API back-end and calls a Microsoft online service such as the Microsoft Graph API or Azure AD Graph API.
124+
Many architectures include a web API that needs to call another downstream web API, where both are secured by Azure AD B2C. This scenario is common in native clients that have a Web API back-end and calls a Microsoft online service such as the Microsoft Graph API.
125125

126126
This chained web API scenario can be supported by using the OAuth 2.0 JWT bearer credential grant, also known as the on-behalf-of flow. However, the on-behalf-of flow is not currently implemented in the Azure AD B2C.
127127

articles/active-directory-b2c/custom-policy-custom-attributes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Your Azure AD B2C directory comes with a built-in set of attributes. Examples ar
2929
* An identity provider has a unique user identifier like **uniqueUserGUID** that must be saved.
3030
* A custom user journey needs to persist for a state of a user like **migrationStatus**.
3131

32-
Azure AD B2C extends the set of attributes stored on each user account. You can also read and write these attributes by using the [Azure AD Graph API](manage-user-accounts-graph-api.md).
32+
Azure AD B2C extends the set of attributes stored on each user account. You can also read and write these attributes by using the [Microsoft Graph API](manage-user-accounts-graph-api.md).
3333

3434
Extension properties extend the schema of the user objects in the directory. The terms *extension property*, *custom attribute*, and *custom claim* refer to the same thing in the context of this article. The name varies depending on the context, such as application, object, or policy.
3535

@@ -292,7 +292,7 @@ The ID token sent back to your application includes the new extension property a
292292

293293
## Reference
294294

295-
For more information on extension properties, see the article [Directory schema extensions | Graph API concepts](/previous-versions/azure/ad/graph/howto/azure-ad-graph-api-directory-schema-extensions).
295+
For more information on extension properties, see the article [Add custom data to resources using extensions](https://docs.microsoft.com/graph/extensibility-overview).
296296

297297
> [!NOTE]
298298
> * A **TechnicalProfile** is an element type, or function, that defines an endpoint’s name, metadata, and protocol. The **TechnicalProfile** details the exchange of claims that the Identity Experience Framework performs. When this function is called in an orchestration step or from another **TechnicalProfile**, the **InputClaims** and **OutputClaims** are provided as parameters by the caller.
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
---
2+
title: Deploy custom policies with Azure Pipelines
3+
titleSuffix: Azure AD B2C
4+
description: Learn how to deploy Azure AD B2C custom policies in a CI/CD pipeline by using Azure Pipelines in Azure DevOps Services.
5+
services: active-directory-b2c
6+
author: mmacy
7+
manager: celestedg
8+
9+
ms.service: active-directory
10+
ms.workload: identity
11+
ms.topic: conceptual
12+
ms.date: 02/14/2020
13+
ms.author: marsma
14+
ms.subservice: B2C
15+
---
16+
17+
# Deploy custom policies with Azure Pipelines
18+
19+
By using a continuous integration and delivery (CI/CD) pipeline that you set up in [Azure Pipelines][devops-pipelines], you can include your Azure AD B2C custom policies in your software delivery and code control automation. As you deploy to different Azure AD B2C environments, for example dev, test, and production, we recommend that you remove manual processes and perform automated testing by using Azure Pipelines.
20+
21+
There are three primary steps required for enabling Azure Pipelines to manage custom policies within Azure AD B2C:
22+
23+
1. Create a web application registration in your Azure AD B2C tenant
24+
1. Configure an Azure Repo
25+
1. Configure an Azure Pipeline
26+
27+
> [!IMPORTANT]
28+
> Managing Azure AD B2C custom policies with an Azure Pipeline currently uses **preview** operations available on the Microsoft Graph API `/beta` endpoint. Use of these APIs in production applications is not supported. For more information, see the [Microsoft Graph REST API beta endpoint reference](https://docs.microsoft.com/graph/api/overview?toc=./ref/toc.json&view=graph-rest-beta).
29+
30+
## Prerequisites
31+
32+
* [Azure AD B2C tenant](tutorial-create-tenant.md), and credentials for a user in the directory with the [B2C IEF Policy Administrator](../active-directory/users-groups-roles/directory-assign-admin-roles.md#b2c-ief-policy-administrator) role
33+
* [Custom policies](custom-policy-get-started.md) uploaded to your tenant
34+
* [Management app](microsoft-graph-get-started.md) registered in your tenant with the Microsoft Graph API permission *Policy.ReadWrite.TrustFramework*
35+
* [Azure Pipeline](https://azure.microsoft.com/services/devops/pipelines/), and access to an [Azure DevOps Services project][devops-create-project]
36+
37+
## Client credentials grant flow
38+
39+
The scenario described here makes use of service-to-service calls between Azure Pipelines and Azure AD B2C by using the OAuth 2.0 [client credentials grant flow](../active-directory/develop/v1-oauth2-client-creds-grant-flow.md). This grant flow permits a web service like Azure Pipelines (the confidential client) to use its own credentials instead of impersonating a user to authenticate when calling another web service (the Microsoft Graph API, in this case). Azure Pipelines obtains a token non-interactively, then makes requests to the Microsoft Graph API.
40+
41+
## Register an application for management tasks
42+
43+
As mentioned in [Prerequisites](#prerequisites), you need an application registration that your PowerShell scripts--executed by Azure Pipelines--can use for accessing the resources in your tenant.
44+
45+
If you already have an application registration that you use for automation tasks, ensure it's been granted the **Microsoft Graph** > **Policy** > **Policy.ReadWrite.TrustFramework** permission within the **API Permissions** of the app registration.
46+
47+
For instructions on registering a management application, see [Manage Azure AD B2C with Microsoft Graph](microsoft-graph-get-started.md).
48+
49+
## Configure an Azure Repo
50+
51+
With a management application registered, you're ready to configure a repository for your policy files.
52+
53+
1. Sign in to your Azure DevOps Services organization.
54+
1. [Create a new project][devops-create-project] or select an existing project.
55+
1. In your project, navigate to **Repos** and select the **Files** page. Select an existing repository or create one for this exercise.
56+
1. Create a folder named *B2CAssets*. Name the required placeholder file *README.md* and **Commit** the file. You can remove this file later, if you like.
57+
1. Add your Azure AD B2C policy files to the *B2CAssets* folder. This includes the *TrustFrameworkBase.xml*, *TrustFrameWorkExtensions.xml*, *SignUpOrSignin.xml*, *ProfileEdit.xml*, *PasswordReset.xml*, and any other policies you've created. Record the filename of each Azure AD B2C policy file for use in a later step (they're used as PowerShell script arguments).
58+
1. Create a folder named *Scripts* in the root directory of the repository, name the placeholder file *DeployToB2c.ps1*. Don't commit the file at this point, you'll do so in a later step.
59+
1. Paste the following PowerShell script into *DeployToB2c.ps1*, then **Commit** the file. The script acquires a token from Azure AD and calls the Microsoft Graph API to upload the policies within the *B2CAssets* folder to your Azure AD B2C tenant.
60+
61+
```PowerShell
62+
[Cmdletbinding()]
63+
Param(
64+
[Parameter(Mandatory = $true)][string]$ClientID,
65+
[Parameter(Mandatory = $true)][string]$ClientSecret,
66+
[Parameter(Mandatory = $true)][string]$TenantId,
67+
[Parameter(Mandatory = $true)][string]$PolicyId,
68+
[Parameter(Mandatory = $true)][string]$PathToFile
69+
)
70+
71+
try {
72+
$body = @{grant_type = "client_credentials"; scope = "https://graph.microsoft.com/.default"; client_id = $ClientID; client_secret = $ClientSecret }
73+
74+
$response = Invoke-RestMethod -Uri https://login.microsoftonline.com/$TenantId/oauth2/v2.0/token -Method Post -Body $body
75+
$token = $response.access_token
76+
77+
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
78+
$headers.Add("Content-Type", 'application/xml')
79+
$headers.Add("Authorization", 'Bearer ' + $token)
80+
81+
$graphuri = 'https://graph.microsoft.com/beta/trustframework/policies/' + $PolicyId + '/$value'
82+
$policycontent = Get-Content $PathToFile
83+
$response = Invoke-RestMethod -Uri $graphuri -Method Put -Body $policycontent -Headers $headers
84+
85+
Write-Host "Policy" $PolicyId "uploaded successfully."
86+
}
87+
catch {
88+
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
89+
90+
$_
91+
92+
$streamReader = [System.IO.StreamReader]::new($_.Exception.Response.GetResponseStream())
93+
$streamReader.BaseStream.Position = 0
94+
$streamReader.DiscardBufferedData()
95+
$errResp = $streamReader.ReadToEnd()
96+
$streamReader.Close()
97+
98+
$ErrResp
99+
100+
exit 1
101+
}
102+
103+
exit 0
104+
```
105+
106+
## Configure your Azure pipeline
107+
108+
With your repository initialized and populated with your custom policy files, you're ready to set up the release pipeline.
109+
110+
### Create pipeline
111+
112+
1. Sign in to your Azure DevOps Services organization and navigate to your project.
113+
1. In your project, select **Pipelines** > **Releases** > **New pipeline**.
114+
1. Under **Select a template**, select **Empty job**.
115+
1. Enter a **Stage name**, for example *DeployCustomPolicies*, then close the pane.
116+
1. Select **Add an artifact**, and under **Source type**, select **Azure Repository**.
117+
1. Choose the source repository containing the *Scripts* folder that you populated with the PowerShell script.
118+
1. Choose a **Default branch**. If you created a new repository in the previous section, the default branch is *master*.
119+
1. Leave the **Default version** setting of *Latest from the default branch*.
120+
1. Enter a **Source alias** for the repository. For example, *policyRepo*. Do not include any spaces in the alias name.
121+
1. Select **Add**
122+
1. Rename the pipeline to reflect its intent. For example, *Deploy Custom Policy Pipeline*.
123+
1. Select **Save** to save the pipeline configuration.
124+
125+
### Configure pipeline variables
126+
127+
1. Select the **Variables** tab.
128+
1. Add the following variables under **Pipeline variables** and set their values as specified:
129+
130+
| Name | Value |
131+
| ---- | ----- |
132+
| `clientId` | **Application (client) ID** of the application you registered earlier. |
133+
| `clientSecret` | The value of the **client secret** that you created earlier. <br /> Change the variable type to **secret** (select the lock icon). |
134+
| `tenantId` | `your-b2c-tenant.onmicrosoft.com`, where *your-b2c-tenant* is the name of your Azure AD B2C tenant. |
135+
136+
1. Select **Save** to save the variables.
137+
138+
### Add pipeline tasks
139+
140+
Next, add a task to deploy a policy file.
141+
142+
1. Select the **Tasks** tab.
143+
1. Select **Agent job**, and then select the plus sign (**+**) to add a task to the Agent job.
144+
1. Search for and select **PowerShell**. Do not select "Azure PowerShell," "PowerShell on target machines," or another PowerShell entry.
145+
1. Select newly added **PowerShell Script** task.
146+
1. Enter following values for the PowerShell Script task:
147+
* **Task version**: 2.*
148+
* **Display name**: The name of the policy that this task should upload. For example, *B2C_1A_TrustFrameworkBase*.
149+
* **Type**: File Path
150+
* **Script Path**: Select the ellipsis (***...***), navigate to the *Scripts* folder, and then select the *DeployToB2C.ps1* file.
151+
* **Arguments:**
152+
153+
Enter the following values for **Arguments**. Replace `{alias-name}` with the alias you specified in the previous section.
154+
155+
```PowerShell
156+
# Before
157+
-ClientID $(clientId) -ClientSecret $(clientSecret) -TenantId $(tenantId) -PolicyId B2C_1A_TrustFrameworkBase -PathToFile $(System.DefaultWorkingDirectory)/{alias-name}/B2CAssets/TrustFrameworkBase.xml
158+
```
159+
160+
For example, if the alias you specified is *policyRepo*, the argument line should be:
161+
162+
```PowerShell
163+
# After
164+
-ClientID $(clientId) -ClientSecret $(clientSecret) -TenantId $(tenantId) -PolicyId B2C_1A_TrustFrameworkBase -PathToFile $(System.DefaultWorkingDirectory)/policyRepo/B2CAssets/TrustFrameworkBase.xml
165+
```
166+
167+
1. Select **Save** to save the Agent job.
168+
169+
The task you just added uploads *one* policy file to Azure AD B2C. Before proceeding, manually trigger the job (**Create release**) to ensure that it completes successfully before creating additional tasks.
170+
171+
If the task completes successfully, add deployment tasks by performing the preceding steps for each of the custom policy files. Modify the `-PolicyId` and `-PathToFile` argument values for each policy.
172+
173+
The `PolicyId` is a value found at the start of an XML policy file within the TrustFrameworkPolicy node. For example, the `PolicyId` in the following policy XML is *B2C_1A_TrustFrameworkBase*:
174+
175+
```XML
176+
<TrustFrameworkPolicy
177+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
178+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
179+
xmlns="http://schemas.microsoft.com/online/cpim/schemas/2013/06"
180+
PolicySchemaVersion="0.3.0.0"
181+
TenantId="contoso.onmicrosoft.com"
182+
PolicyId= "B2C_1A_TrustFrameworkBase"
183+
PublicPolicyUri="http://contoso.onmicrosoft.com/B2C_1A_TrustFrameworkBase">
184+
```
185+
186+
When running the agents and uploading the policy files, ensure they're uploaded in this order:
187+
188+
1. *TrustFrameworkBase.xml*
189+
1. *TrustFrameworkExtensions.xml*
190+
1. *SignUpOrSignin.xml*
191+
1. *ProfileEdit.xml*
192+
1. *PasswordReset.xml*
193+
194+
The Identity Experience Framework enforces this order as the file structure is built on a hierarchical chain.
195+
196+
## Test your pipeline
197+
198+
To test your release pipeline:
199+
200+
1. Select **Pipelines** and then **Releases**.
201+
1. Select the pipeline you created earlier, for example *DeployCustomPolicies*.
202+
1. Select **Create release**, then select **Create** to queue the release.
203+
204+
You should see a notification banner that says that a release has been queued. To view its status, select the link in the notification banner, or select it in the list on the **Releases** tab.
205+
206+
## Next steps
207+
208+
Learn more about:
209+
210+
* [Service-to-service calls using client credentials](https://docs.microsoft.com/azure/active-directory/develop/v1-oauth2-client-creds-grant-flow)
211+
* [Azure DevOps Services](https://docs.microsoft.com/azure/devops/user-guide/?view=azure-devops)
212+
213+
<!-- LINKS - External -->
214+
[devops]: https://docs.microsoft.com/azure/devops/?view=azure-devops
215+
[devops-create-project]: https://docs.microsoft.com/azure/devops/organizations/projects/create-project?view=azure-devops
216+
[devops-pipelines]: https://docs.microsoft.com/azure/devops/pipelines

articles/active-directory-b2c/faq.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,17 @@ Currently there is no way to change the "From:" field on the email.
8282

8383
### How can I migrate my existing user names, passwords, and profiles from my database to Azure AD B2C?
8484

85-
You can use the Azure AD Graph API to write your migration tool. See the [User migration guide](user-migration.md) for details.
85+
You can use the Microsoft Graph API to write your migration tool. See the [User migration guide](user-migration.md) for details.
8686

8787
### What password user flow is used for local accounts in Azure AD B2C?
8888

89-
The Azure AD B2C password user flow for local accounts is based on the policy for Azure AD. Azure AD B2C's sign-up, sign-up or sign-in and password reset user flows use the "strong" password strength and don't expire any passwords. Read the [Azure AD password policy](/previous-versions/azure/jj943764(v=azure.100)) for more details. For information about account lockouts and passwords, see [Manages threats to resources and data in Azure Active Directory B2C](threat-management.md).
89+
The Azure AD B2C password user flow for local accounts is based on the policy for Azure AD. Azure AD B2C's sign-up, sign-up or sign-in and password reset user flows use the "strong" password strength and don't expire any passwords. For more details, see [Password policies and restrictions in Azure Active Directory](https://docs.microsoft.com/azure/active-directory/authentication/concept-sspr-policy).
90+
91+
For information about account lockouts and passwords, see [Manages threats to resources and data in Azure Active Directory B2C](threat-management.md).
9092

9193
### Can I use Azure AD Connect to migrate consumer identities that are stored on my on-premises Active Directory to Azure AD B2C?
9294

93-
No, Azure AD Connect is not designed to work with Azure AD B2C. Consider using the [Azure AD Graph API](manage-user-accounts-graph-api.md) for user migration. See the [User migration guide](user-migration.md) for details.
95+
No, Azure AD Connect is not designed to work with Azure AD B2C. Consider using the [Microsoft Graph API](manage-user-accounts-graph-api.md) for user migration. See the [User migration guide](user-migration.md) for details.
9496

9597
### Can my app open up Azure AD B2C pages within an iFrame?
9698

0 commit comments

Comments
 (0)