重要
Azure Stack Hub 的 SQL 與 MySQL 資源提供者已不再支援,無法提供新客戶的入門服務。 相反地,直接在虛擬機上部署 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。
- 舊系統。<location.sqladapter> 資源群組與系統。<預設提供者訂閱中的 location.dbadapter.dns> 資源群組不會被腳本自動刪除。
暫時將儲存帳號和 金鑰保存庫 放在 sqladapter 資源群組中。 如果升級後,任何租戶使用者發現資料庫或登入的元資料不一致,可以獲得資源群組支援還原元資料。
確認 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 本會建立一個包含最新作業系統映像檔的新虛擬機(VM),部署最新的資源提供者程式碼,並將設定從舊資源提供者遷移到新的資源提供者。
註釋
建議您從 Marketplace 管理下載 Microsoft AzureStack 擴充功能 RP Windows Server 1.2009.0 映像檔。 如果您需要安裝更新,您可以將 單一 MSU 套件放在本機相依性路徑中。 如果此位置有多個 MSU 檔案,腳本將會失敗。
腳本建立新虛擬機後 UpdateSQLProvider.ps1 ,會從舊資源提供者虛擬機遷移以下設定:
- 資料庫資訊
- 主機伺服器資訊
- 必要的 DNS 記錄
重要
在執行部署或更新腳本前,使用 Clear-AzureRmContext -Scope CurrentUser 和 Clear-AzureRmContext -Scope Process 來清除快取。
更新文本參數
執行 PowerShell 腳本時 UpdateSQLProvider.ps1 ,請在命令列指定以下參數。 如果你沒有指定參數,或任何參數驗證失敗,腳本會提示你提供所需的參數。
| 參數名稱 | 描述 | 批註或預設值 |
|---|---|---|
| CloudAdminCredential | 存取特權端點所需的雲端管理員憑證。 | 必要 |
| AzCredential | Azure Stack Hub 服務管理員帳戶的認證。 使用您用來部署 Azure Stack Hub 的相同認證。 如果你用 AzCredential 使用的帳號需要多重驗證(MFA),腳本就會失敗。 | 必要 |
| VM本地憑證 | SQL 資源提供者 VM 之本機系統管理員帳戶的認證。 | 必要 |
| 特權端點 | 具特殊許可權端點的IP位址或 DNS 名稱。 | 必要 |
| 微軟Azure環境 | 你用來部署 Azure Stack Hub 的服務管理員帳號的 Azure 環境。 僅適用於 Microsoft Entra 部署。 支援的環境名稱 AzureCloud、AzureUSGovernment,或使用 China Microsoft Entra ID,AzureChinaCloud。 | AzureCloud |
| DependencyFilesLocalPath | 您也必須將憑證 .pfx 檔案放在此目錄中。 | 可選擇的適用於單一節點,但對於多節點則是必須的 |
| 預設SSL憑證密碼 | .pfx 憑證的密碼。 | 必要 |
| MaxRetryCount | 若操作失敗,指定您希望重試每個作業的次數。 | 2 |
| 重試時間 | 重試之間的逾時間隔,以秒為單位。 | 120 |
| 卸載 | 拿掉資源提供者和所有相關聯的資源。 | 不 |
| 偵錯模式 | 防止在失敗時自動進行清理。 | 不 |
更新腳本 PowerShell 範例
要將 SQL 資源提供者更新至 1.1.33.0 或更早版本,請在 PowerShell 模組中安裝特定版本 AzureRm.BootStrapper 的 and Azure Stack Hub 模組。
如果你要將 SQL 資源提供者更新到 1.1.47.0 或更新版本,可以跳過這個步驟。 部署腳本會自動下載並安裝你所需的 PowerShell 模組,供你前往 。C:\Program Files\SqlMySqlPsh
註釋
如果該資料夾 C:\Program Files\SqlMySqlPsh 已經包含下載的 PowerShell 模組,請先清理這個資料夾再執行更新腳本。 此步驟確保下載並使用正確版本的 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 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 工作階段。