|
30 | 30 |
|
31 | 31 | - 在一台 Windows 设备上执行以下 powershell 命令,( powershell 最好为 5.1 版本 ) |
32 | 32 |
|
33 | | -1. 安装 powershell 的 AAD 支持模块 |
34 | | -```PowerShell |
35 | | -Install-Module -Name MSOnline |
36 | | -``` |
37 | | - |
38 | | -2. 运行以下 powershell 脚本,配置联邦认证 |
39 | | -```PowerShell |
40 | | -Connect-MsolService # 连接AAD |
41 | | -
|
42 | | -# 开启联邦认证 |
43 | | -$dom = "test.aad-test.teamory.cn" #AAD 中的自定义域名,前面配置过的 |
44 | | -$BrandName = "Authing SAML 2.0 IDP" #可取自己希望取的名字 |
45 | | -# 前面步骤中复制的用户池地址 |
46 | | -$LogOnUrl = "上一步复制的 LogOnUrl" |
47 | | -$LogOffUrl = "上一步复制的 LogoutUrl" |
48 | | -$MyURI = "上一步复制的 EntityId" |
49 | | -$MySigningCert = "之前记录的 X.509 cert in string format" #前面步骤复制过的 |
50 | | -$Protocol = "SAMLP" |
51 | | -Set-MsolDomainAuthentication ` |
52 | | - -DomainName $dom ` |
53 | | - -FederationBrandName $BrandName ` |
54 | | - -Authentication Federated ` |
55 | | - -PassiveLogOnUri $LogOnUrl ` |
56 | | - -SigningCertificate $MySigningCert ` |
57 | | - -IssuerUri $MyURI ` |
58 | | - -LogOffUri $LogOffUrl ` |
59 | | - -PreferredAuthenticationProtocol $Protocol |
60 | | -
|
61 | | -# 创建新用户 |
62 | | -New-MsolUser ` |
63 | | -#登录 AAD 所需账号,@左侧可自行取名,@右侧为本文件中的 "$dom" |
64 | | - -UserPrincipalName swire-cocacola@test.aad-test.teamory.cn ` |
65 | | - #为 AAD 中的唯一标识符 |
66 | | - -ImmutableId swire-cocacola ` |
67 | | - #可自行选取名称 |
68 | | - -DisplayName "Swire CocaCola" ` |
69 | | -``` |
70 | | - |
71 | | -3. 若在上一步中操作失败或之前配置过,可通过以下代码行回退 |
72 | | - |
73 | | -```PowerShell |
74 | | -# 关闭联邦认证 |
75 | | -$dom = "test.aad-test.teamory.cn" #AAD 中的自定义域名,在第 8 步中配置过 |
76 | | -Set-MsolDomainAuthentication ` |
77 | | - -DomainName $dom ` |
78 | | - -Authentication Managed |
79 | | -``` |
| 33 | + - 方式一:使用 [Microsoft Graph PowerShell SDK](https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation?view=graph-powershell-1.0) |
| 34 | + 1. 安装 powershell 的 Microsoft.Graph 支持模块 |
| 35 | + ```PowerShell |
| 36 | + Install-Module Microsoft.Graph -Scope CurrentUser |
| 37 | + ``` |
| 38 | +
|
| 39 | + 2. 运行以下 powershell 脚本,配置联邦认证 |
| 40 | + ```PowerShell |
| 41 | + Connect-MgGraph # 连接AAD |
| 42 | + |
| 43 | + # 开启联邦认证 |
| 44 | + $dom = "test.aad-test.teamory.cn" #AAD 中的自定义域名,前面配置过的 |
| 45 | + $BrandName = "Authing SAML 2.0 IDP" #可取自己希望取的名字 |
| 46 | + # 前面步骤中复制的用户池地址 |
| 47 | + $LogOnUrl = "上一步复制的 LogOnUrl" |
| 48 | + $LogOffUrl = "上一步复制的 LogoutUrl" |
| 49 | + $MyURI = "上一步复制的 EntityId" |
| 50 | + $MySigningCert = "之前记录的 X.509 cert in string format" #前面步骤复制过的 |
| 51 | + $Protocol = "saml" |
| 52 | + New-MgDomainFederationConfiguration ` |
| 53 | + -DomainId $dom ` |
| 54 | + -DisplayName $BrandName ` |
| 55 | + -PassiveSignInUri $LogOnUrl ` |
| 56 | + -SigningCertificate $MySigningCert ` |
| 57 | + -IssuerUri $MyURI ` |
| 58 | + -SignOutUri $LogOffUrl ` |
| 59 | + -PreferredAuthenticationProtocol $Protocol ` |
| 60 | + -FederatedIdpMfaBehavior "rejectMfaByFederatedIdp" |
| 61 | + |
| 62 | + # 创建新用户 |
| 63 | + #登录 AAD 所需账号,@左侧可自行取名,@右侧为本文件中的 "$dom" |
| 64 | + New-MgUser ` |
| 65 | + -UserPrincipalName "test-authing@test.aad-test.teamory.cn" ` |
| 66 | + -DisplayName "test-authing" ` |
| 67 | + -mailNickname "test-authing" ` |
| 68 | + -AccountEnabled ` |
| 69 | + -OnPremisesImmutableId 'test-authing' |
| 70 | + ``` |
| 71 | +
|
| 72 | + 3. 若在上一步中操作失败或之前配置过,可通过以下代码行回退 |
| 73 | +
|
| 74 | + ```PowerShell |
| 75 | + # 关闭联邦认证 |
| 76 | + $dom = "test.aad-test.teamory.cn" #AAD 中的自定义域名,在第 8 步中配置过 |
| 77 | + Update-MgDomain -DomainId $dom -AuthenticationType Managed |
| 78 | + ``` |
| 79 | + - ~~方式二~~(官方停用):使用 **MSOnline PowerShell**(**此模块已弃用**) |
| 80 | + 1. 安装 powershell 的 AAD 支持模块 |
| 81 | + ```PowerShell |
| 82 | + Install-Module -Name MSOnline |
| 83 | + ``` |
| 84 | + |
| 85 | + 2. 运行以下 powershell 脚本,配置联邦认证 |
| 86 | + ```PowerShell |
| 87 | + Connect-MsolService # 连接AAD |
| 88 | + |
| 89 | + # 开启联邦认证 |
| 90 | + $dom = "test.aad-test.teamory.cn" #AAD 中的自定义域名,前面配置过的 |
| 91 | + $BrandName = "Authing SAML 2.0 IDP" #可取自己希望取的名字 |
| 92 | + # 前面步骤中复制的用户池地址 |
| 93 | + $LogOnUrl = "上一步复制的 LogOnUrl" |
| 94 | + $LogOffUrl = "上一步复制的 LogoutUrl" |
| 95 | + $MyURI = "上一步复制的 EntityId" |
| 96 | + $MySigningCert = "之前记录的 X.509 cert in string format" #前面步骤复制过的 |
| 97 | + $Protocol = "SAMLP" |
| 98 | + Set-MsolDomainAuthentication ` |
| 99 | + -DomainName $dom ` |
| 100 | + -FederationBrandName $BrandName ` |
| 101 | + -Authentication Federated ` |
| 102 | + -PassiveLogOnUri $LogOnUrl ` |
| 103 | + -SigningCertificate $MySigningCert ` |
| 104 | + -IssuerUri $MyURI ` |
| 105 | + -LogOffUri $LogOffUrl ` |
| 106 | + -PreferredAuthenticationProtocol $Protocol |
| 107 | + |
| 108 | + # 创建新用户 |
| 109 | + New-MsolUser ` |
| 110 | + #登录 AAD 所需账号,@左侧可自行取名,@右侧为本文件中的 "$dom" |
| 111 | + -UserPrincipalName swire-cocacola@test.aad-test.teamory.cn ` |
| 112 | + #为 AAD 中的唯一标识符 |
| 113 | + -ImmutableId swire-cocacola ` |
| 114 | + #可自行选取名称 |
| 115 | + -DisplayName "Swire CocaCola" ` |
| 116 | + ``` |
| 117 | + |
| 118 | + 3. 若在上一步中操作失败或之前配置过,可通过以下代码行回退 |
| 119 | + |
| 120 | + ```PowerShell |
| 121 | + # 关闭联邦认证 |
| 122 | + $dom = "test.aad-test.teamory.cn" #AAD 中的自定义域名,在第 8 步中配置过 |
| 123 | + Set-MsolDomainAuthentication ` |
| 124 | + -DomainName $dom ` |
| 125 | + -Authentication Managed |
| 126 | + ``` |
80 | 127 |
|
81 | 128 | </IntegrationDetailCard> |
0 commit comments