設定 AD FS

 

適用于:Windows Azure Pack

作為啟用 Windows Azure Active Directory Federation Services (AD FS) for Windows Azure Pack for Windows Server 的第一個步驟,您必須設定 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 網頁的 服務主要名稱

後續步驟