ASDK 的部署後組態Post deployment configurations for ASDK

安裝 Azure Stack 開發套件 (ASDK) 後,您在 ASDK 主機電腦上以 AzureStack\AzureStackAdmin 身分登入時,應該進行一些建議的安裝後組態變更。After you install the Azure Stack Development Kit (ASDK), you should make a few recommended post deployment configuration changes while signed in as AzureStack\AzureStackAdmin on the ASDK host computer.

安裝 Azure Stack PowerShellInstall Azure Stack PowerShell

您需要與 Azure Stack 相容的 Azure PowerShell 模組,才能搭配 Azure Stack 使用。Azure Stack compatible Azure PowerShell modules are required to work with Azure Stack.

Azure Stack 的 PowerShell 命令是透過 PowerShell 資源庫進行安裝。PowerShell commands for Azure Stack are installed through the PowerShell Gallery. 若要註冊 PSGallery 存放庫,請開啟提升權限的 PowerShell 工作階段,並執行下列命令:To register the PSGallery repository, open an elevated PowerShell session and run the following command:

Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted

使用 API 版本設定檔來指定 Azure Stack 相容的 Az 模組。Use API version profiles to specify Azure Stack compatible Az modules. API 版本設定檔提供一個管理 Azure 與 Azure Stack 之間版本差異的方式。API version profiles provide a way to manage version differences between Azure and Azure Stack. API 版本設定檔是一組具有特定 API 版本的 Az PowerShell 模組。An API version profile is a set of Az PowerShell modules with specific API versions. 可透過 PowerShell 資源庫取得的 Az 模組可提供使用 API 版本設定檔所需的 PowerShell Cmdlet。The Az.BootStrapper module that's available through the PowerShell Gallery provides PowerShell cmdlets that are required to work with API version profiles.

您可以安裝最新的 Azure Stack PowerShell 模組,其具有或不具有與 ASDK 主機電腦的網際網路連線能力。You can install the latest Azure Stack PowerShell module with or without internet connectivity to the ASDK host computer.

  1. 驗證您在 Windows 電腦上的必要條件。Validate your prerequisites on your Windows machine. 如需指示,請參閱 Windows 的必要條件For instructions see Prerequisites for Windows.
  2. 安裝所需的 PowerShell 版本之前,請確定 卸載任何現有的 Azure PowerShell 模組Before installing the required PowerShell version, make sure that you uninstall any existing Azure PowerShell modules.
  • 使用來自 ASDK 主機電腦的 網際網路連線:執行下列 PowerShell 腳本,在您的 ASDK 安裝上安裝這些模組:With an internet connection from the ASDK host computer: Run the following PowerShell script to install these modules on your ASDK installation:
  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

  Install-Module -Name Az.BootStrapper -Force -AllowPrerelease
  Install-AzProfile -Profile 2019-03-01-hybrid -Force
  Install-Module -Name AzureStack -RequiredVersion 2.0.2-preview -AllowPrerelease

  Get-Module -Name "Az*" -ListAvailable
  Get-Module -Name "Azs*" -ListAvailable

如果安裝成功,則會在輸出中顯示 Az 和 AzureStack 模組。If the installation is successful, the Az and AzureStack modules are displayed in the output.

  • 如果沒有來自 ASDK 主機電腦的 網際網路連線:在中斷連線的情況下,您必須先使用下列 PowerShell 命令,將 PowerShell 模組下載至具有網際網路連線能力的電腦:Without an internet connection from the ASDK host computer: In a disconnected scenario, you must first download the PowerShell modules to a machine that has internet connectivity using the following PowerShell commands:
$Path = "<Path that is used to save the packages>"

Save-Package `
  -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name Az -Path $Path -Force -RequiredVersion 2.3.0

Save-Package `
  -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name AzureStack -Path $Path -Force -RequiredVersion 1.5.0

接下來,將下載的套件複製到 ASDK 電腦,並將位置註冊為預設存放庫,並從此存放庫安裝 Az 和 AzureStack 模組:Next, copy the downloaded packages to the ASDK computer and register the location as the default repository and install the Az and AzureStack modules from this repository:

$SourceLocation = "<Location on the development kit that contains the PowerShell packages>"
$RepoName = "MyNuGetSource"

Register-PSRepository -Name $RepoName -SourceLocation $SourceLocation -InstallationPolicy Trusted

Install-Module Az -Repository $RepoName

Install-Module AzureStack -Repository $RepoName

下載 Azure Stack 工具Download the Azure Stack tools

AzureStack-Tools 是一個 GitHub 存放庫,當中裝載用來管理資源並將其部署至 Azure Stack 的 PowerShell 模組。AzureStack-Tools is a GitHub repository that hosts PowerShell modules for managing and deploying resources to Azure Stack. 您可以使用 Az PowerShell 模組或 AzureRM 模組來使用這些工具。You use the tools using the Az PowerShell modules, or the AzureRM modules.

若要取得這些工具,請從 az 分支複製 GitHub 存放庫,或執行下列指令碼以下載 AzureStack-Tools 資料夾:To get these tools, clone the GitHub repository from the az branch or download the AzureStack-Tools folder by running the following script:

# Change directory to the root directory.
cd \

# Download the tools archive.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 
invoke-webrequest `
  https://github.com/Azure/AzureStack-Tools/archive/az.zip `
  -OutFile az.zip

# Expand the downloaded files.
expand-archive az.zip `
  -DestinationPath . `
  -Force

# Change to the tools directory.
cd AzureStack-Tools-az

驗證 ASDK 安裝Validate the ASDK installation

若要確保 ASDK 部署成功,請依照下列步驟使用 Test-AzureStack Cmdlet:To ensure that your ASDK deployment was successful, use the Test-AzureStack cmdlet by following these steps:

  1. 以 AzureStack\AzureStackAdmin 身分登入 ASDK 主機電腦。Sign in as AzureStack\AzureStackAdmin on the ASDK host computer.
  2. 以系統管理員身分開啟 PowerShell (非 PowerShell ISE)。Open PowerShell as an admin (not PowerShell ISE).
  3. 執行:Enter-PSSession -ComputerName AzS-ERCS01 -ConfigurationName PrivilegedEndpointRun: Enter-PSSession -ComputerName AzS-ERCS01 -ConfigurationName PrivilegedEndpoint
  4. 執行:Test-AzureStackRun: Test-AzureStack

這些測試需要幾分鐘才能完成。The tests take a few minutes to complete. 如果安裝成功,輸出看起來像這樣:If the installation was successful, the output looks something like:

測試 Azure Stack - 安裝成功

如果發生失敗,請依照疑難排解步驟來取得協助。If there was a failure, follow the troubleshooting steps to get help.

啟用多租用戶Enable multi-tenancy

如需使用 Azure AD 來部署,您需要為 ASDK 安裝啟用多租用戶For deployments using Azure AD, you need to enable multi-tenancy for your ASDK installation.

注意

當登入 Azure Stack 入口網站的系統管理員或使用者帳戶不是來自用來註冊 Azure Stack 的網域名稱時,則必須將用來註冊 Azure Stack 的網域名稱附加到入口網站 URL。When admin or user accounts from domains other than the one used to register Azure Stack are used to log in to an Azure Stack portal, the domain name used to register Azure Stack must be appended to the portal URL. 例如,如果使用 fabrikam.onmicrosoft.com 註冊了 Azure Stack,且登入的使用者帳戶是 admin@contoso.com,則用來登入使用者入口網站的 URL 會是:https://portal.local.azurestack.external/fabrikam.onmicrosoft.com。For example, if Azure Stack has been registered with fabrikam.onmicrosoft.com and the user account logging in is admin@contoso.com, the URL to use to log in to the user portal would be: https://portal.local.azurestack.external/fabrikam.onmicrosoft.com.

下一步Next steps

向 Azure 註冊 ASDKRegister the ASDK with Azure