本文介绍如何停用 Azure Stack Hub 系统。 在回收系统硬件之前,请遵循此过程,确保租户工作负荷受到保护,删除敏感信息,并且系统未注册Azure。
先决条件
在开始之前,请确保满足以下先决条件:
- 使用适当的备份从系统中删除所有工作负荷。
- 无需从系统完全停止或删除所有资源(VM、Web 应用等)。 但是,可以在停用过程中停止或删除这些资源来管理使用情况和成本。
- 系统永久关闭后,不会报告任何进一步的使用信息。
已连接(Microsoft Entra ID)场景
在连接的(Entra ID)环境中执行以下步骤:
通过删除次级目录来禁用多租户功能:取消注册访客目录。
确认你已删除所有其他来宾目录:检索标识健康状况报告。
删除任何用于使用情况计费的租户注册: 删除租户映射。
删除Azure Stack Hub注册并防止使用情况数据推送到Azure计费。
- 按照 Register Azure Stack Hub 中的步骤导入 RegisterWithAzure.psm1 模块。
- 使用以下脚本删除注册资源。
# Select the subscription used during the registration (shown in portal) Select-AzSubscription -Subscription '<Registration subscription ID from portal>' # Unregister using the parameter values from portal Remove-AzsRegistration -PrivilegedEndpointCredential $YourCloudAdminCredential -PrivilegedEndpoint $YourPrivilegedEndpoint -RegistrationName '<Registration name from portal>' -ResourceGroupName '<Registration resource group from portal>'删除Azure Stack Hub的Microsoft Entra应用注册:
在与上一步相同的 PowerShell 实例中,运行以下脚本以导出所有应用注册 ID 的列表。
$context = Get-AzContext if (!$context.Subscription){ @" # Connect To Azure Stack Admin Azure Resource Manager endpoint first https://docs.azure.cn/azure-stack/operator/azure-stack-powershell-configure-admin#connect-with-azure-ad "@ | Write-Host -ForegroundColor:Red } "Getting access token for tenant {0}" -f $context.Subscription.TenantID | Write-Host -ForegroundColor Green $azureRmProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile $profileClient = New-Object Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient($azureRmProfile) $newtoken = $profileClient.AcquireAccessToken($context.Subscription.TenantID) $armEndpoint = $context.Environment.ResourceManagerUrl $applicationRegistrationParams = @{ Method = [Microsoft.PowerShell.Commands.WebRequestMethod]::Get Headers = @{ Authorization = "Bearer " + $newtoken.AccessToken } Uri = "$($armEndpoint.ToString().TrimEnd('/'))/applicationRegistrations?api-version=2014-04-01-preview" } $applicationRegistrations = Invoke-RestMethod @applicationRegistrationParams | Select-Object -ExpandProperty value "[{0}] App Registrations were found for {1}" -f $applicationRegistrations.appId.Count, $context.Environment.Name | Write-Host -ForegroundColor Green $applicationRegistrations.appId | Write-Host请与 Entra 管理员协作,删除之前生成的列表中的应用注册。
注释
请谨慎执行应用注册清理。 除特权终结点(PEP)外,删除这些应用注册后,你的 Azure Stack Hub 系统将无法使用。 无法还原应用注册,系统在未重新部署的情况下将无法正常运行。
离线场景
对于断开连接的环境,请按照从 Azure Stack Hub 中删除激活资源过程操作。
关闭Azure Stack Hub
可以通过两种方式关闭Azure Stack Hub系统。 这两个选项都需要云管理员连接到 特权终结点:
关闭Azure Stack Hub(可恢复):从 Privileged Endpoint 运行 Stop-AzureStack PowerShell cmdlet。
关闭Azure Stack Hub(不可恢复,数据已擦除):从 Privileged Endpoint 运行 Start-AzsCryptoWipe cmdlet。
Important
运行此命令后,该标记无法恢复。