![](/img/trans.png)
[英]Create Azure AD B2C local account user with Powershell New-AzureADUser
[英]Create Azure AD B2C custom policies and applications using powershell
我想在 Azure AD B2C 中創建自定義 B2C 策略和 B2C 應用程序。 我已經參考了這里的文檔,它對我來說工作得很好。
我的問題是我必須執行Identity Experience Framework下的所有步驟,以及為我必須使用 B2C 功能的每個新租戶創建新應用程序的步驟。 在瀏覽了此處的文檔之后,我發現了這個
從 Azure 門戶中的 Azure AD B2C 刀片創建的應用程序必須從同一位置進行管理。 如果使用 PowerShell 或其他門戶編輯 B2C 應用程序,它們將不受支持,並且無法與 Azure AD B2C 一起使用。
但我無法從中推斷出很多關於自定義策略的信息。
我想知道是否可以使用 powershell 腳本等自動化方式來實現創建自定義 B2C 策略以及創建 B2C 應用程序的目的。
由於 B2C 自定義策略已正式發布,現在可以使用 PowerShell 創建自定義策略。
在這里查看我的回答: Recommended way to automate deplyoment of Azure AD B2C instance?
您可以使用 PowerShell AzureADPreview 2.0 模塊來創建應用程序。
完整文檔在這里: AzureADPreview 2 文檔
我沒有成功將此模塊安裝到“舊” PowerShell (5.x),因此我試了一下“新”PowerShell 7 (Core)。 PowerShell 7 和 AzureAD 模塊的唯一問題是Connect-AzureAD
使用 .NET Core 中沒有的加密函數,因此您必須使用-UseWindowsPowerShell
選項導入 AzureADPreview 模塊。
這是一個示例,適用於 PowerShell 7:
Install-Module AzureADPreview
Import-Module AzureADPreview -UseWindowsPowerShell
$tenantId = "yourb2ctenant.onmicrosoft.com"
# Note: this will interactively ask your credentials.
# If you want to run this unattended, use the -Credential parameter with a PSCredential object with a SecureString
Connect-AzureAD -TenantId $tenantId
# ready to go
#list your all apps
Get-AzureADApplication
# examine one of you app and get ideas
$application = Get-AzureADApplication -ObjectId af46a788-8e55-4301-b2df-xxxxxxxxx
# create and application
$applicationName = "yourappname"
$application = New-AzureADApplication -DisplayName $applicationName -PublicClient $true etc
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.