更新 SQL 資源提供者
重要
從 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 版 | Microsoft AzureStack 擴充功能 RP Windows Server 1.2009.0 |
2108, 2206 | SQL RP 2.0.6.x 版 | Microsoft 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 下載至 Marketplace。
請確定符合數據中心整合必要條件。
先決條件 | 參考 |
---|---|
已正確設定條件式 DNS 轉送。 | Azure Stack Hub 數據中心整合 - DNS |
資源提供者的入站端口已開啟。 | Azure Stack Hub 資料中心整合 - 埠和通訊協定輸入 |
PKI 憑證主體和SAN已正確設定。 |
Azure Stack Hub 部署必要的 PKI 必要條件 Azure Stack Hub 部署 PaaS 憑證必要條件 |
- ( 適用於中斷連線的環境 )安裝必要的 PowerShell 模組,類似於用來 部署資源提供者的更新程式。
觸發重大版本升級
從提升許可權的 PowerShell 控制台執行下列腳本,以執行主要版本升級。
註釋
請確保您執行腳本的用戶端電腦的作業系統版本不早於 Windows 10 或 Windows Server 2016,並且用戶端電腦具有 X64 作業系統架構。
重要
強烈建議使用 Clear-AzureRmContext -Scope CurrentUser 和 Clear-AzureRmContext -Scope Process,在執行部署或更新腳本之前清除快取。
# 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. Supported values for the <environment name> parameter are AzureCloud, AzureChinaCloud, or AzureUSGovernment depending which Azure subscription you're using.
$AzureEnvironment = "AzureCloud"
# 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.onmicrosoft.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
注意
SQL RP V2 的 DNS 位址和對應的 IP 位址不同。 若要取得新的公用IP,您可以連絡支持人員以要求DRP中斷玻璃並尋找 SQLRPVM1130-PublicIP 資源。 您也可以從已通過端點測試的客戶端機器執行“nslookup sqlrp.dbadapter.<fqdn>”來找出公用 IP。
驗證升級是否成功
- MajorVersionUpgrade 腳本執行時沒有任何錯誤。
- 檢查 Marketplace 中的資源提供者,並確定已成功安裝 SQL RP 2.0。
- 舊的 系統。<位置>.sqladapter 資源群組和 系統。<位置>.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),部署最新的資源提供者程序代碼,並將設定從舊的資源提供者移轉至新的資源提供者。
備註
建議您從 Marketplace 管理下載 Microsoft AzureStack 擴充功能 RP Windows Server 1.2009.0 映像檔。 如果您需要安裝更新,您可以將 單一 MSU 套件放在本機相依性路徑中。 如果此位置有多個 MSU 檔案,腳本將會失敗。
UpdateSQLProvider.ps1 腳本建立新的 VM 之後,腳本會從舊的資源提供者 VM 移轉下列設定:
- 資料庫資訊
- 主機伺服器資訊
- 必要的 DNS 記錄
重要
強烈建議使用 Clear-AzureRmContext -Scope CurrentUser 和 Clear-AzureRmContext -Scope Process,在執行部署或更新腳本之前清除快取。
更新文本參數
當您執行 UpdateSQLProvider.ps1 PowerShell 文稿時,您可以從命令行指定下列參數。 如果您未這麼做,或有任何參數驗證失敗,系統會提示您提供必要的參數。
參數名稱 | 描述 | 批註或預設值 |
---|---|---|
CloudAdminCredential | 存取特權端點所需的雲端管理員憑證。 | 必要 |
AzCredential | Azure Stack Hub 服務管理員帳戶的認證。 使用您用來部署 Azure Stack Hub 的相同認證。 如果您搭配 AzCredential 使用的帳戶需要多重身份驗證(MFA),該腳本可能會失敗。 | 必要 |
VMLocalCredential | SQL 資源提供者 VM 之本機系統管理員帳戶的認證。 | 必要 |
特權端點 | 具特殊許可權端點的IP位址或 DNS 名稱。 | 必要 |
AzureEnvironment | 您用來部署 Azure Stack Hub 的服務管理員帳戶 Azure 環境。 僅適用於 Microsoft Entra 部署。 支援的環境名稱 AzureCloud、AzureUSGovernment,或使用 China Microsoft Entra ID,AzureChinaCloud。 | AzureCloud |
DependencyFilesLocalPath | 您也必須將憑證 .pfx 檔案放在此目錄中。 | 可選擇的適用於單一節點,但對於多節點則是必須的 |
DefaultSSLCertificatePassword | .pfx 憑證的密碼。 | 必要 |
MaxRetryCount | 若操作失敗,指定您希望重試每個作業的次數。 | 2 |
RetryDuration | 重試之間的逾時間隔,以秒為單位。 | 120 |
卸載 | 拿掉資源提供者和所有相關聯的資源。 | 不 |
偵錯模式 | 防止在失敗時自動進行清理。 | 不 |
更新腳本 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 資源提供者 取得詳細資訊
以下是使用可從提升許可權的PowerShell控制台執行 UpdateSQLProvider.ps1 腳本的範例。 請務必視需要變更變數信息和密碼:
# 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 are AzureCloud, AzureChinaCloud, or AzureUSGovernment 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.onmicrosoft.com"
$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 工作階段。