在 Azure Stack Hub 中更新 MySQL 资源提供程序Update the MySQL resource provider in Azure Stack Hub


在更新资源提供程序之前,请查看发行说明,了解新功能、修补程序以及任何可能影响部署的已知问题。Before updating the resource provider, review the release notes to learn about new functionality, fixes, and any known issues that could affect your deployment. 发行说明还指定资源提供程序所需的最低 Azure Stack Hub 版本。The release notes also specify the minimum Azure Stack Hub version required for the resource provider.

更新 Azure Stack Hub 内部版本时,可能会发布新的 MySQL 资源提供程序适配器。A new MySQL resource provider adapter might be released when Azure Stack Hub builds are updated. 虽然现有的适配器可以继续使用,但仍建议尽快更新到最新的内部版本。While the existing adapter continues to work, we recommend updating to the latest build as soon as possible.

支持的 Azure Stack Hub 版本Supported Azure Stack Hub version MySQL RP 版本MySQL RP version RP 服务正在其上运行的 Windows ServerWindows Server that RP service is running on
2008、20052008, 2005 MySQL RP 版本 RP version Microsoft AzureStack 附加 RP Windows ServerMicrosoft AzureStack Add-on RP Windows Server
2005、2002、19102005, 2002, 1910 MySQL RP 版本 RP version Windows Server 2016 Datacenter - Server CoreWindows Server 2016 Datacenter - Server Core
19081908 MySQL RP 版本 RP version Windows Server 2016 Datacenter - Server CoreWindows Server 2016 Datacenter - Server Core

MySQL 资源提供程序更新是累积的。MySQL resource provider update is cumulative. 从旧版本更新时,可以直接更新到最新版本。When updating from an old version, you can directly update to the latest version.

若要更新资源提供程序,请使用 UpdateMySQLProvider.ps1 脚本。To update the resource provider, you use the UpdateMySQLProvider.ps1 script. 使用具有本地管理权限且是订阅的 所有者 的服务帐户。Use your service account with local administrative rights and is an owner of the subscription. 资源提供程序的下载包中提供此更新脚本。The update script is included with the download of the resource provider.

更新过程类似于部署资源提供程序时使用的过程。The update process is similar to the process used to Deploy the resource provider. 更新脚本与 DeployMySqlProvider.ps1 脚本使用相同的参数,你需要提供证书信息。The update script uses the same arguments as the DeployMySqlProvider.ps1 script, and you'll need to provide certificate information.

更新脚本过程Update script processes

UpdateMySQLProvider.ps1 脚本使用最新的 OS 映像创建新的虚拟机 (VM),部署最新的资源提供程序代码,并将设置从旧资源提供程序迁移到新资源提供程序。The UpdateMySQLProvider.ps1 script creates a new virtual machine (VM) with the latest OS image, deploy the latest resource provider code, and migrates the settings from the old resource provider to the new resource provider.


建议从市场管理下载最新的 Windows Server 2016 Core 映像或 Microsoft AzureStack 加载项 RP Windows Server 映像。We recommend that you download the latest Windows Server 2016 Core image or Microsoft AzureStack Add-on RP Windows Server image from Marketplace Management. 如需安装更新,可以将 单个 MSU 包放置在本地依赖项路径中。If you need to install an update, you can place a single MSU package in the local dependency path. 如果此位置中有多个 MSU 文件,则脚本将失败。The script will fail if there's more than one MSU file in this location.

UpdateMySQLProvider.ps1 脚本在创建新的 VM 后,会从旧的资源提供程序 VM 中迁移以下设置:After the UpdateMySQLProvider.ps1 script creates a new VM, the script migrates the following settings from the old resource provider VM:

  • 数据库信息database information
  • 宿主服务器信息hosting server information
  • 必要的 DNS 记录required DNS record

更新脚本参数Update script parameters

运行 UpdateMySQLProvider.ps1 PowerShell 脚本时,可在命令行中指定以下参数。Specify the following parameters from the command line when you run the UpdateMySQLProvider.ps1 PowerShell script. 如果未指定参数或任何参数验证失败,系统会提示提供所需的参数。If you don't, or if any parameter validation fails, you're prompted to provide the required parameters.

参数名称Parameter Name 说明Description 注释或默认值Comment or default value
CloudAdminCredentialCloudAdminCredential 访问特权终结点时所需的云管理员凭据。The credential for the cloud admin, necessary for accessing the privileged endpoint. 必需Required
AzCredentialAzCredential Azure Stack Hub 服务管理员帐户的凭据。The credentials for the Azure Stack Hub service admin account. 使用部署 Azure Stack Hub 时所用的相同凭据。Use the same credentials that you used for deploying Azure Stack Hub. 如果用于 AzCredential 的帐户需要多重身份验证 (MFA),则脚本将失败。The script will fail if the account you use with AzCredential requires multi-factor authentication (MFA). 必需Required
VMLocalCredentialVMLocalCredential SQL 资源提供程序 VM 的本地管理员帐户的凭据。The credentials for the local admin account of the SQL resource provider VM. 必需Required
PrivilegedEndpointPrivilegedEndpoint 特权终结点的 IP 地址或 DNS 名称。The IP address or DNS name of the privileged endpoint. 必需Required
AzureEnvironmentAzureEnvironment 用于部署 Azure Stack Hub 的服务管理员帐户的 Azure 环境。The Azure environment of the service admin account used for deploying Azure Stack Hub. 仅对于 Azure AD 部署是必需的。Required only for Azure AD deployments. 受支持的环境名称是 AzureChinaCloudSupported environment name is AzureChinaCloud. AzureChinaCloudAzureChinaCloud
DependencyFilesLocalPathDependencyFilesLocalPath 同样必须将证书 .pfx 文件放在此目录中。Your certificate .pfx file must be placed in this directory as well. 可选(对于多节点部署是 必需 的)Optional (mandatory for multi-node)
DefaultSSLCertificatePasswordDefaultSSLCertificatePassword .pfx 证书的密码。The password for the .pfx certificate. 必需Required
MaxRetryCountMaxRetryCount 操作失败时,想要重试每个操作的次数。The number of times you want to retry each operation if there's a failure. 22
RetryDurationRetryDuration 每两次重试的超时间隔(秒)。The timeout interval between retries, in seconds. 120120
卸载Uninstall 删除资源提供程序和所有关联的资源(请参阅下面的注释)。Remove the resource provider and all associated resources (see the following notes). No
DebugModeDebugMode 防止在失败时自动清除。Prevents automatic cleanup on failure. No
AcceptLicenseAcceptLicense 跳过接受 GPL 许可条款的提示。Skips the prompt to accept the GPL license. (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)(https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)

更新脚本示例Update script example

如果要将 MySQL 资源提供程序版本更新为 或早期版本,则需要在 PowerShell 中安装特定版本的 AzureRm.BootStrapper 和 Azure Stack Hub 模块。If you are updating the MySQL resource provider version to or previous versions, you need to install specific versions of AzureRm.BootStrapper and Azure Stack Hub modules in PowerShell.

如果要将 MySQL 资源提供程序更新到版本 或更高版本,可以跳过此步骤。If you are updating the MySQL resource provider to version or later, you can skip this step. 部署脚本会自动下载所需的 PowerShell 模块并将其安装到路径 C:\Program Files\SqlMySqlPsh。The deployment script will automatically download and install the necessary PowerShell modules for you to path C:\Program Files\SqlMySqlPsh.


如果文件夹 C:\Program Files\SqlMySqlPsh 已存在并已下载 PowerShell 模块,建议在运行更新脚本之前清理此文件夹。If folder C:\Program Files\SqlMySqlPsh already exists with PowerShell module downloaded, it is recommended to clean up this folder before running the update script. 这是为了确保下载并使用正确版本的 PowerShell 模块。This is to make sure the right version of PowerShell module is downloaded and used.

# Run the following scripts when updating to version 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 模块并手动注册存储库,这是先决条件。In disconnected scenario, you need to download the required PowerShell modules and register the repository manually as a prerequisite. 可以在部署 MySQL 资源提供程序中获取详细信息You can get more information in Deploy MySQL resource provider

以下示例演示可以通过权限提升的 PowerShell 控制台运行的 UpdateMySQLProvider.ps1 脚本。The following example shows the UpdateMySQLProvider.ps1 script that you can run from an elevated PowerShell console. 请务必根据需要更改变量信息和密码:Be sure to change the variable information and passwords as needed:

# Use the NetBIOS name for the Azure Stack Hub domain. On the Azure Stack Hub SDK, the default is AzureStack but could have been changed at install time.
$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 environment name is  AzureChinaCloud. 
$AzureEnvironment = "<EnvironmentName>"

# Point to the directory where the resource provider installation files were extracted. 
$tempDir = 'C:\TEMP\MYSQLRP' 

# The service admin account (can be Azure Active Directory or Active Directory Federation Services).
$serviceAdmin = "admin@mydomain.partner.onmschina.cn" 
$AdminPass = ConvertTo-SecureString "P@ssw0rd1" -AsPlainText -Force 
$AdminCreds = New-Object System.Management.Automation.PSCredential ($serviceAdmin, $AdminPass) 
# Set credentials for the new resource provider VM.
$vmLocalAdminPass = ConvertTo-SecureString "P@ssw0rd1" -AsPlainText -Force 
$vmLocalAdminCreds = New-Object System.Management.Automation.PSCredential ("mysqlrpadmin", $vmLocalAdminPass) 
# And 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 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\UpdateMySQLProvider.ps1 -AzCredential $AdminCreds `
-VMLocalCredential $vmLocalAdminCreds `
-CloudAdminCredential $cloudAdminCreds `
-PrivilegedEndpoint $privilegedEndpoint `
-AzureEnvironment $AzureEnvironment `
-DefaultSSLCertificatePassword $PfxPass `
-DependencyFilesLocalPath $tempDir\cert `

资源提供程序更新脚本完成后,请关闭当前的 PowerShell 会话。When the resource provider update script finishes, close the current PowerShell session.

后续步骤Next steps

维护 MySQL 资源提供程序Maintain MySQL resource provider