重新部署 ASDKRedeploy the ASDK

本文介绍如何在非生产环境中重新部署 Azure Stack 开发工具包 (ASDK)。In this article, you'll learn how to redeploy the Azure Stack Development Kit (ASDK) in a non-production environment. 由于不支持 ASDK 升级,因此若要改用较新的版本,需彻底地进行重新部署。Because upgrading the ASDK isn't supported, you need to completely redeploy it to move to a newer version. 还可以在希望从头开始的任何时候重新部署 ASDK。You can also redeploy the ASDK whenever you want to start from scratch.

Important

不支持将 ASDK 升级到新的版本。Upgrading the ASDK to a new version isn't supported. 每次需要对较新版的 Azure Stack 进行评估时,必须在 ASDK 主计算机上重新部署 ASDK。You've to redeploy the ASDK on the ASDK host computer each time you want to evaluate a newer version of Azure Stack.

删除 Azure 注册Remove Azure registration

如果以前已将 ASDK 安装注册到 Azure,则应在重新部署 ASDK 之前删除注册资源。If you've previously registered your ASDK installation with Azure, you should remove the registration resource before redeploying the ASDK. 重新部署 ASDK 时,请重新注册 ASDK 以使市场中可以提供项目。Re-register the ASDK to enable the availability of items in the marketplace when you redeploy the ASDK. 如果以前未将 ASDK 注册到 Azure 订阅,则可跳过此部分。If you haven't previously registered the ASDK with your Azure subscription, you can skip this section.

若要删除注册资源,请使用 Remove-AzsRegistration cmdlet 注销 Azure Stack。To remove the registration resource, use the Remove-AzsRegistration cmdlet to unregister Azure Stack. 然后,使用 Remove-AzureRMResourceGroup cmdlet 从 Azure 订阅中删除 Azure Stack 资源组:Then, use the Remove-AzureRMResourceGroup cmdlet to delete the Azure Stack resource group from your Azure subscription:

  1. 在能够访问特权终结点的计算机上以管理员身份打开 PowerShell 控制台。Open a PowerShell console as an admin on a computer that has access to the privileged endpoint. 对于 ASDK 来说,该计算机是 ASDK 主计算机。For the ASDK, that's the ASDK host computer.

  2. 运行以下 PowerShell 命令,注销 ASDK 安装并从 Azure 订阅中删除 azurestack 资源组:Run the following PowerShell commands to unregister your ASDK installation and delete the azurestack resource group from your Azure subscription:

    #Import the registration module that was downloaded with the GitHub tools
    Import-Module C:\AzureStack-Tools-master\Registration\RegisterWithAzure.psm1
    
    # Provide Azure subscription admin credentials
    Add-AzureRmAccount -EnvironmentName AzureChinaCloud
    
    # Provide ASDK admin credentials
    $CloudAdminCred = Get-Credential -UserName AZURESTACK\CloudAdmin -Message "Enter the cloud domain credentials to access the privileged endpoint"
    
    # Unregister Azure Stack
    Remove-AzsRegistration `
       -PrivilegedEndpointCredential $CloudAdminCred `
       -PrivilegedEndpoint AzS-ERCS01
    
    # Remove the Azure Stack resource group
    Remove-AzureRmResourceGroup -Name azurestack -Force
    
  3. 当脚本运行时,系统会提示你登录 Azure 订阅和本地 ASDK 安装。You're prompted to sign in to both your Azure subscription and the local ASDK installation when the script runs.

  4. 脚本完成后,会看到与以下示例类似的消息:When the script completes, you should see messages similar to the following examples:

    De-Activating Azure Stack (this may take up to 10 minutes to complete). Your environment is now unable to syndicate items and is no longer reporting usage data.De-Activating Azure Stack (this may take up to 10 minutes to complete). Your environment is now unable to syndicate items and is no longer reporting usage data. Remove registration resource from Azure... "Deleting the resource..." on target "/subscriptions/<subscription information>" ********** End Log: Remove-AzsRegistration *********

此时 Azure Stack 应该会成功地从 Azure 订阅注销。Azure Stack should now successfully be unregistered from your Azure subscription. 还应删除 azurestack 资源组。The azurestack resource group should also be deleted. 此资源组是首次向 Azure 注册 ASDK 时创建的资源组。This resource group is the one created when you first registered the ASDK with Azure.

部署 ASDKDeploy the ASDK

若要重新部署 Azure Stack,必须从头开始进行,如下所述。To redeploy Azure Stack, you must start over from scratch as described below. 这些步骤可能会有所不同,具体取决于是否使用了 Azure Stack 安装程序 (asdk-installer.ps1) 脚本来安装 ASDK。The steps are different depending on whether or not you used the Azure Stack installer (asdk-installer.ps1) script to install the ASDK.

使用安装程序脚本重新部署 ASDKRedeploy the ASDK using the installer script

  1. 在 ASDK 计算机上打开提升了权限的 PowerShell 控制台,导航到非系统驱动器上 AzureStack_Installer 目录中的 asdk-installer.ps1 脚本。On the ASDK computer, open an elevated PowerShell console and navigate to the asdk-installer.ps1 script in the AzureStack_Installer directory located on a non-system drive. 运行脚本,然后单击“重启”。 Run the script and click Reboot.

    运行 asdk-installer.ps1 脚本

  2. 选择基础操作系统(非 Azure Stack),然后单击“下一步” 。Select the base operating system (not Azure Stack) and click Next.

    重启到主机操作系统中

  3. 在 ASDK 主机重新启动到基本操作系统中以后,以本地管理员身份登录。找到并删除先前的部署过程中使用过的 C:\CloudBuilder.vhdx 文件。After the ASDK host reboots into the base operating system, log in as a local admin. Locate and delete the C:\CloudBuilder.vhdx file that was used as part of the previous deployment.

  4. 重复首次部署 ASDK 时执行过的步骤。Repeat the same steps that you took to first deploy the ASDK.

在不使用安装程序的情况下重新部署 ASDKRedeploy the ASDK without using the installer

如果未使用 asdk-installer.ps1 脚本来安装 ASDK,必须以手动方式重新配置 ASDK 主计算机,然后才能重新部署 ASDK。If you didn't use the asdk-installer.ps1 script to install the ASDK, you must manually reconfigure the ASDK host computer before redeploying the ASDK.

  1. 在 ASDK 计算机上运行 msconfig.exe,以便启动系统配置实用程序。Start the System Configuration utility by running msconfig.exe on the ASDK computer. 在“启动”选项卡上选择主机操作系统(不是 Azure Stack),单击“设置为默认值”,然后单击“确定”。 On the Boot tab, select the host computer operating system (not Azure Stack), click Set as default, and then click OK. 出现提示时单击“重启” 。Click Restart when prompted.

    设置启动配置

  2. 在 ASDK 主机重新启动到基本操作系统中以后,以 ASDK 主计算机的本地管理员身份登录。After the ASDK host reboots into the base operating system, log in as a local admin for the ASDK host computer. 找到并删除先前的部署过程中使用过的 C:\CloudBuilder.vhdx 文件。Locate and delete the C:\CloudBuilder.vhdx file that was used as part of the previous deployment.

  3. 重复首次使用 PowerShell 部署 ASDK 时执行过的步骤。Repeat the same steps that you took to first deploy the ASDK using PowerShell.

后续步骤Next steps

ASDK 后部署任务Post ASDK deployment tasks