配置 AD FS

 

适用于:Windows Azure Pack

作为为 Windows Azure Pack for Windows Server 启用 Windows Azure Active Directory 联合身份验证服务 (AD FS) 的第一步,必须按照以下步骤中所述配置 AD FS。

配置 AD FS

  1. 如果您使用现有 AD FS,请执行以下操作:

    1. 在 AD FS 中,使用以下地址为租户的管理员和管理门户添加管理门户作为信赖方:

      <门户 URI>/federationMetadata/2007-06/Federationmetadata.xml

      将 <门户 URI> 替换为管理员的管理门户地址和租户的管理门户。

      例如: https://www.contosotenant.com/federationMetadata/2007-06/Federationmetadata.xml

    2. 对租户管理门户应用以下转换规则:

      • 将 AD 组转换为“组”声明

      • 将电子邮件地址转换为 UPN 声明

    3. 跳过其余步骤并转到 Configure the management portals to trust AD FS

  2. 如果您正在设置新的 AD FS,请在要用于 AD FS 的计算机上,启用 AD FS 角色。

  3. 以域管理员的身份登录到该计算机。 有两个选项可用于配置 AD FS:运行 Install-AdfsFarm cmdlet 或运行脚本。

    • 运行 Install-AdfsFarm cmdlet 以配置 AD FS。

      Install-AdfsFarm –CertificateThumbprint <String> -FederationServiceName <String> -ServiceAccountCredential <PSCredential> -SQLConnectionString <String>
      

      必须提供以下信息才能运行 Install-AdfsFarm cmdlet。

      Cmdlet 参数

      所需信息

      –CertificateThumbprint

      安全套接字层 (SSL) 证书指纹。 证书应安装在 <local_machine>\My Store 中。

      -FederationServiceName

      AD FS 服务的完全限定域名 (FQDN)。

      -ServiceAccountCredential

      运行 AD FS 的域服务帐户。

      -SQLConnectionString

      用于连接承载 AD FS 数据库的 Microsoft SQL Server 实例的 SQL 连接字符串。

    • 或者,运行以下脚本来配置 AD FS。

      注意

      您必须在运行此脚本前安装 makecert.exe。 也可以使用 IIS 创建自签名证书,然后将指纹传入此脚本。

      # Set these values:
      $domainName = 'contoso.com'
      $adfsPrefix = 'AzurePack-adfs'
      $username = 'username' 
      $password = 'password'
      $dnsName = ($adfsPrefix + "." + $domainName)
      
      # Generate Self Signed Certificate
      Import-Module -Name 'PKI','WebAdministration'
      # You must install makecert.exe before running this script. Alternatively use the IIS UI to create a self-signed certificate and pass the thumbprint in this script
      
      $item = Get-Item -Path 'IIS:\SslBindings\0.0.0.0!443' -ErrorAction SilentlyContinue
      if (!$item)
      {
      MakeCert.exe -n "CN=$dnsName" -r -pe -sky exchange -ss My -sr LocalMachine -eku 1.3.6.1.5.5.7.3.1
      cert = ,(Get-ChildItem 'Cert:\LocalMachine\My' | Where-Object { $_.Subject -eq "CN=$dnsName" })[0]
      }
      $thumbprint = $cert.Thumbprint
      $securePassword = ConvertTo-SecureString -String $password -Force -AsPlainText
      $adfsServiceCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList ($domainname + '\' + $username), $securePassword
      
      # If you want to install AD FS with a database, provide this data. Otherwise it will install with the Windows Internal Database (which should be enabled 
      # prior to configuring AD fS)
      $dbServer = 'AzurePack-SQl'
      $dbUsername = 'sa'
      $dbPassword = '<SQL_password>'
      $adfsSqlConnectionString = [string]::Format('Data Source={0};Initial Catalog=master;User ID={1};Password={2}', $dbServer, $dbUsername, $dbPassword)
      
      # Configure AD FS
      Install-AdfsFarm `
          -CertificateThumbprint $thumbprint `
          -FederationServiceName $dnsName `
          -ServiceAccountCredential $adfsServiceCredential `
          -SQLConnectionString $adfsSqlConnectionString `
          -OverwriteConfiguration
      

    提示

    如果收到有关服务主体名称 (SPN) 重复的错误消息,请使用 Setspn 工具删除 SPN,然后重新添加,如下所示:

    1. 在 AD FS 计算机上的命令提示符处,运行 Setspn 工具以删除重复的 SPN:

      setspn -u -d http/$dnsname $username

    2. 在 AD FS 计算机上的命令提示符处,运行 Setspn 工具以添加新 SPN:

      setspn -u -s http/$dnsname $username

    有关 SPN 的详细信息,请访问有关 服务主体名称的 MSDN 页面。

后续步骤