重要
从 Azure Stack Hub 版本 2108 开始,SQL 和 MySQL 资源提供程序将提供给已授予访问权限的订阅用户。 如果想要开始使用此功能,或者需要从以前的版本升级, 打开支持案例,我们的支持工程师将指导你完成部署或升级过程。
重要
在更新资源提供程序之前,请查看发行说明,了解新功能、修补程序以及可能影响部署的任何已知问题。 发行说明还指定资源提供程序所需的最低 Azure Stack Hub 版本。
重要
更新资源提供程序不会更新托管 SQL Server。
当 Azure Stack Hub 更新到新版本时,可能会发布新的 SQL 资源提供程序。 尽管现有资源提供程序继续工作,但建议尽快更新到最新版本。
支持的 Azure Stack Hub 版本 | SQL RP 版本 | 运行 RP 服务的 Windows Server |
---|---|---|
2206, 2301, 2306, 2311 | SQL RP 版本 2.0.13.x | 微软 AzureStack 插件 RP Windows Server 1.2009.0 |
2108, 2206 | SQL RP 版本 2.0.6.x | 微软 AzureStack 插件 RP Windows Server 1.2009.0 |
更新 SQL Server 资源提供程序 V2
如果已部署 SQL RP V2,并且想要检查更新,请检查 如何将更新应用到资源提供程序。
如果要从 SQL RP V1 更新到 SQL RP V2,请确保先更新到 SQL RP V1.1.93.x,然后应用主要版本升级过程,以便从 SQL RP V1 升级到 SQL RP V2。
从 SQL RP V1.1.93.x 更新到 SQL RP V2.0.6.0
先决条件
请确保已将 SQL RP V1 更新到最新的 1.1.93.x。 在“默认提供程序订阅”下,找到 RP 资源组(命名格式:system.
<region
>.sqladapter)。 确认资源组中的版本标记和 SQL RP VM 名称。 如果仍处于旧版本,并且需要更新到 1.1.93.x,请打开支持案例以获取帮助。建立支持案例以获取 MajorVersionUpgrade 包,并将订阅添加到未来 V2 版本的 ASH 市场允许列表中。
将 Microsoft AzureStack Add-On RP Windows Server 1.2009.0 下载到市场。
确保满足数据中心集成先决条件。
先决条件 | 参考文献 |
---|---|
条件 DNS 转发已正确设置。 | Azure Stack Hub 数据中心集成 - DNS |
资源提供程序的入站端口处于打开状态。 | Azure Stack Hub 数据中心集成 - 端口和协议入站 |
PKI 证书主题和 SAN 已正确设置。 |
Azure Stack Hub 部署必需的 PKI 先决条件 Azure Stack Hub 部署 PaaS 证书先决条件 |
- (对于断开连接的环境)安装所需的 PowerShell 模块,类似于用于 部署资源提供程序的更新过程。
触发 MajorVersionUpgrade
从提升的 PowerShell 控制台运行以下脚本以执行主版本升级。
注释
确保运行脚本的客户端计算机的作系统版本不超过 Windows 10 或 Windows Server 2016,并且客户端计算机具有 X64作系统体系结构。
重要
强烈建议在运行部署或更新脚本之前使用 Clear-AzureRmContext -Scope CurrentUser 和 Clear-AzureRmContext -Scope 进程 清除缓存。
# Check Operating System version
$osVersion = [environment]::OSVersion.Version
if ($osVersion.Build -lt 10240)
{
Write-Host "OS version is too old: $osVersion."
return
}
$osArch = (Get-WmiObject Win32_OperatingSystem).OSArchitecture
if ($osArch -ne "64-bit")
{
Write-Host "OS Architecture is not 64 bit."
return
}
# Check LongPathsEnabled registry key
$regPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem'
$longPathsEnabled = 'LongPathsEnabled'
$property = Get-ItemProperty -Path $regPath -Name $longPathsEnabled -ErrorAction Stop
if ($property.LongPathsEnabled -eq 0)
{
Write-Host "Detect LongPathsEnabled equals to 0, prepare to set the property."
Set-ItemProperty -Path $regPath -Name $longPathsEnabled -Value 1 -ErrorAction Stop
Write-Host "Set the long paths property, please restart the PowerShell."
return
}
# Use the NetBIOS name for the Azure Stack Hub domain.
$domain = "YouDomain"
# For integrated systems, use the IP address of one of the ERCS VMs
$privilegedEndpoint = "YouDomain-ERCS01"
# Provide the Azure environment used for deploying Azure Stack Hub. Required only for Azure AD deployments.
$AzureEnvironment = "AzureChinaCloud"
# Point to the directory where the resource provider installation files were extracted.
$tempDir = 'C:\extracted-folder\MajorVersionUpgrade-SQLRP'
# The service admin account can be Azure Active Directory or Active Directory Federation Services.
$serviceAdmin = "admin@mydomain.partner.onmschina.com"
$AdminPass = ConvertTo-SecureString 'xxxxxxxx' -AsPlainText -Force
$AdminCreds = New-Object System.Management.Automation.PSCredential ($serviceAdmin, $AdminPass)
# Add the cloudadmin credential that's required for privileged endpoint access.
$CloudAdminPass = ConvertTo-SecureString 'xxxxxxxx' -AsPlainText -Force
$CloudAdminCreds = New-Object System.Management.Automation.PSCredential ("$domain\cloudadmin", $CloudAdminPass)
# Change the following as appropriate.
$PfxPass = ConvertTo-SecureString 'xxxxxxx' -AsPlainText -Force
# Provide the pfx file path
$PfxFilePath = "C:\tools\sqlcert\SSL.pfx"
# PowerShell modules used by the RP MajorVersionUpgrade are placed in C:\Program Files\SqlMySqlPsh
# The deployment script adds this path to the system $env:PSModulePath to ensure correct modules are used.
$rpModulePath = Join-Path -Path $env:ProgramFiles -ChildPath 'SqlMySqlPsh'
$env:PSModulePath = $env:PSModulePath + ";" + $rpModulePath
. $tempDir\MajorVersionUpgradeSQLProvider.ps1 -AzureEnvironment $AzureEnvironment -AzCredential $AdminCreds -CloudAdminCredential $CloudAdminCreds -Privilegedendpoint $privilegedEndpoint -PfxPassword $PfxPass -PfxCert $PfxFilePath
注释
DNS 地址和 SQL RP V2 的相应 IP 地址不同。 要获取新的公共 IP,可以联系客户支持以要求执行 DRP 紧急操作并查找 SQLRPVM1130-PublicIP 资源。 您还可以在那台已通过终结点测试的客户端计算机上运行“nslookup sqlrp.dbadapter.<fqdn>”来找出公共 IP。
验证升级是否成功
- 执行 MajorVersionUpgrade 脚本时没有任何错误。
- 检查市场中的资源提供程序,并确保已成功安装 SQL RP 2.0。
- 旧system.<location>.sqladapter 资源组和默认提供程序订阅中的 system.<location>.dbadapter.dns 资源组不会由脚本自动删除。
- 建议在 sqladapter 资源组中保留存储帐户和 Key Vault 一段时间。 如果在升级后,任何用户观察到数据库或登录元数据不一致,可以获得支持来从资源组还原元数据。
- 验证 dbadapter.dns 资源组中的 DNS 区域是否为空且没有 DNS 记录后,可以安全地删除 dbadapter.dns 资源组。
- [重要提示]请勿使用 V1 部署脚本卸载 V1 版本。 升级完成后,确认升级成功,可以从提供程序订阅手动删除资源组。
从 SQL RP V1 早期版本更新到 SQL RP V1.1.93.x
SQL 资源提供程序 V1 更新是累积的。 可以直接更新到 1.1.93.x 版本。
若要将资源提供程序更新为 1.1.93.x,请使用 UpdateSQLProvider.ps1 脚本。 使用具有本地管理权限且是订阅的所有者的服务帐户。 此更新脚本包含在资源提供程序下载中。
更新过程类似于用于 部署资源提供程序的过程。 更新脚本使用与 DeploySqlProvider.ps1 脚本相同的参数,需要提供证书信息。
更新脚本进程
UpdateSQLProvider.ps1 脚本使用最新的 OS 映像创建新的虚拟机(VM),部署最新的资源提供程序代码,并将设置从旧资源提供程序迁移到新的资源提供程序。
注释
建议从市场管理下载 Microsoft AzureStack 附加产品 RP Windows Server 1.2009.0 映像。 如果需要安装更新,可以在本地依赖项路径中放置 单个 MSU 包。 如果此位置有多个 MSU 文件,脚本将失败。
UpdateSQLProvider.ps1 脚本创建新 VM 后,该脚本将从旧的资源提供程序 VM 迁移以下设置:
- 数据库信息
- 托管服务器信息
- 所需的 DNS 记录
重要
强烈建议在运行部署或更新脚本之前使用 Clear-AzureRmContext -Scope CurrentUser 和 Clear-AzureRmContext -Scope 进程 清除缓存。
更新脚本参数
运行 UpdateSQLProvider.ps1 PowerShell 脚本时,可以从命令行指定以下参数。 如果没有,或者任何参数验证失败,系统会提示你提供所需的参数。
参数名称 | DESCRIPTION | 注释或默认值 |
---|---|---|
CloudAdminCredential | 访问特权终结点时所需的云管理员凭据。 | 必需 |
AzCredential | Azure Stack Hub 服务管理员帐户的凭据。 使用用于部署 Azure Stack Hub 的相同凭据。 如果使用 AzCredential 的帐户需要多重身份验证(MFA),脚本将失败。 | 必需 |
VMLocalCredential | SQL 资源提供程序 VM 的本地管理员帐户的凭据。 | 必需 |
PrivilegedEndpoint | 特权终结点的 IP 地址或 DNS 名称。 | 必需 |
AzureEnvironment | 用于部署 Azure Stack Hub 的服务管理员帐户的 Azure 环境。 仅在 Microsoft Entra 部署中为必需。 支持的环境名称为 AzureChinaCloud。 | AzureChinaCloud |
DependencyFilesLocalPath 依赖文件的本地路径 | 还必须在此目录中放置证书 .pfx 文件。 | 对于单节点是可选的,但多节点是必需的 |
默认SSL证书密码 | .pfx 证书的密码。 | 必需 |
MaxRetryCount | 如果发生失败,你想重试每个操作的次数。 | 2 |
RetryDuration | 每两次重试的超时间隔(秒)。 | 120 |
卸载 | 删除资源提供程序和所有关联的资源。 | 否 |
DebugMode | 防止在失败时自动清除。 | 否 |
更新脚本 PowerShell 示例
如果要将 SQL 资源提供程序版本更新为 1.1.33.0 或以前的版本,则需要在 PowerShell 中安装特定版本的 AzureRm.BootStrapper 和 Azure Stack Hub 模块。
如果要将 SQL 资源提供程序更新到版本 1.1.47.0 或更高版本,则可以跳过此步骤。 部署脚本将自动下载并安装所需的 PowerShell 模块,并设置路径为 C:\Program Files\SqlMySqlPsh。
注释
如果下载了 PowerShell 模块时已存在文件夹 C:\Program Files\SqlMySqlPsh,建议在运行更新脚本之前清理此文件夹。 这是为了确保下载和使用正确的 PowerShell 模块版本。
# Run the following scripts when updating to version 1.1.33.0 only.
# Install the AzureRM.Bootstrapper module, set the profile, and install the AzureStack module.
# Note that this might not be the most currently available version of Azure Stack Hub PowerShell.
Install-Module -Name AzureRm.BootStrapper -Force
Use-AzureRmProfile -Profile 2018-03-01-hybrid -Force
Install-Module -Name AzureStack -RequiredVersion 1.6.0
注释
在断开连接的情况下,需要下载所需的 PowerShell 模块,并手动注册存储库作为先决条件。 可以在部署 SQL 资源提供程序中获取详细信息
下面是 UpdateSQLProvider.ps1 脚本的使用示例,该脚本可以通过提升的 PowerShell 控制台来运行。 根据需要务必更改可变信息和密码。
# Use the NetBIOS name for the Azure Stack Hub domain. On the Azure Stack Hub SDK, the default is AzureStack but this might have been changed at installation.
$domain = "AzureStack"
# For integrated systems, use the IP address of one of the ERCS VMs.
$privilegedEndpoint = "AzS-ERCS01"
# Provide the Azure environment used for deploying Azure Stack Hub. Required only for Azure AD deployments. Supported values for the <environment name> parameter is AzureChinaCloud depending which Azure subscription you're using.
$AzureEnvironment = "<EnvironmentName>"
# Point to the directory where the resource provider installation files were extracted.
$tempDir = 'C:\TEMP\SQLRP'
# The service admin account (this can be Azure AD or AD FS).
$serviceAdmin = "admin@mydomain.partner.onmschina.cn"
$AdminPass = ConvertTo-SecureString 'P@ssw0rd1' -AsPlainText -Force
$AdminCreds = New-Object System.Management.Automation.PSCredential ($serviceAdmin, $AdminPass)
# Set the credentials for the new resource provider VM.
$vmLocalAdminPass = ConvertTo-SecureString 'P@ssw0rd1' -AsPlainText -Force
$vmLocalAdminCreds = New-Object System.Management.Automation.PSCredential ("sqlrpadmin", $vmLocalAdminPass)
# Add the cloudadmin credential required for privileged endpoint access.
$CloudAdminPass = ConvertTo-SecureString 'P@ssw0rd1' -AsPlainText -Force
$CloudAdminCreds = New-Object System.Management.Automation.PSCredential ("$domain\cloudadmin", $CloudAdminPass)
# Change the following as appropriate.
$PfxPass = ConvertTo-SecureString 'P@ssw0rd1' -AsPlainText -Force
# For version 1.1.47.0 or later, the PowerShell modules used by the RP deployment are placed in C:\Program Files\SqlMySqlPsh
# The deployment script adds this path to the system $env:PSModulePath to ensure correct modules are used.
$rpModulePath = Join-Path -Path $env:ProgramFiles -ChildPath 'SqlMySqlPsh'
$env:PSModulePath = $env:PSModulePath + ";" + $rpModulePath
# Change directory to the folder where you extracted the installation files.
# Then adjust the endpoints.
. $tempDir\UpdateSQLProvider.ps1 -AzCredential $AdminCreds -VMLocalCredential $vmLocalAdminCreds -CloudAdminCredential $cloudAdminCreds -PrivilegedEndpoint $privilegedEndpoint -AzureEnvironment $AzureEnvironment -DefaultSSLCertificatePassword $PfxPass -DependencyFilesLocalPath $tempDir\cert
资源提供程序更新脚本完成后,关闭当前的 PowerShell 会话。