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 Add-on RP Windows Server 1.2009.0
2108, 2206 SQL RP バージョン 2.0.6.x Microsoft AzureStack Add-on 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 への更新

前提条件

  1. SQL RP V1 が最新の 1.1.93.x に更新されていることを確認します。 [既定のプロバイダー サブスクリプション] で RP リソース グループを見つけます (名前付け形式: system.<region>.sqladapter)。 リソース グループで、バージョン タグと SQL RP VM 名を確認します。 まだ古いバージョンを使用していて、1.1.93.x に更新する必要がある場合は、サポート ケースを開いてサポートを受けます。

  2. サポート ケースを開いて MajorVersionUpgrade パッケージを取得し、お使いのサブスクリプションを今後の V2 バージョンの ASH マーケットプレースの許可リストに追加します。

  3. Microsoft AzureStack Add-On RP Windows Server 1.2009.0 をマーケットプレースにダウンロードします。

  4. データセンターの統合の前提条件を満たしていることを確認します。

前提条件 リファレンス
条件付き DNS フォワーダーが正しく設定されている。 Azure Stack Hub とデータセンターの統合 - DNS
リソース プロバイダー用の受信ポートが開いている。 Azure Stack Hub データセンターの統合 - ポートとプロトコル (受信)
PKI 証明書のサブジェクトと SAN が正しく設定されている。 Azure Stack Hub デプロイの必須 PKI 前提条件
Azure Stack Hub デプロイの PaaS 証明書の前提条件
  1. (切断された環境の場合)リソース プロバイダーのデプロイに使用される更新プロセスと同様に、必要な PowerShell モジュール をインストールします

MajorVersionUpgrade のトリガー

管理者特権の PowerShell コンソールから次のスクリプトを実行して、メジャー バージョンのアップグレードを実行します。

Note

スクリプトを実行するクライアント コンピューターの OS バージョンが 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

Note

DNS アドレスと、SQL RP V2 の対応する IP アドレスは異なります。 新しいパブリック IP を取得するには、サポートに連絡して DRP ブレーク グラスを要求し、SQLRPVM1130-PublicIP リソースを見つけます。 また、既にエンドポイント テストに合格したクライアント コンピューターから "nslookup sqlrp.dbadapter.<fqdn>" を実行してパブリック IP を確認することもできます。

アップグレードが成功したことを検証する

  1. MajorVersionUpgrade スクリプトがエラーなしで実行されました。
  2. マーケットプレースのリソース プロバイダーをチェックし、SQL RP 2.0 が正常にインストールされていることを確認します。
  3. 既定のプロバイダー サブスクリプションの古い system.location>.sqladapter リソース グループと > リソース グループは、スクリプトによって自動的に削除されません。
  • ストレージ アカウントとKey Vaultは、しばらくの間、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 スクリプトにより、最新の OS イメージを使用して新しい仮想マシン (VM) が作成され、最新のリソース プロバイダーのコードがデプロイされて、古いリソース プロバイダーから新しいリソース プロバイダーに設定が移行されます。

Note

Marketplace Management から Microsoft AzureStack Add-on RP Windows Server 1.2009.0 イメージをダウンロードすることをお勧めします。 更新プログラムをインストールする必要がある場合は、ローカルの依存関係のパスに MSU パッケージを 1 つ配置できます。 この場所に複数の 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 のローカル管理者アカウントの資格情報。 必須
PrivilegedEndpoint 特権エンドポイントの IP アドレスまたは DNS 名。 必須
AzureEnvironment Azure Stack Hub のデプロイに使用したサービス管理者アカウントの Azure 環境。 Microsoft Entraデプロイにのみ必要です。 サポートされている環境名は、AzureCloudAzureUSGovernment、または China Microsoft Entra ID AzureChinaCloud を使用している場合です。 AzureCloud
DependencyFilesLocalPath このディレクトリには、証明書 .pfx ファイルも配置する必要があります。 "1 つのノードの場合は省略可能。複数のノードの場合は必須"
DefaultSSLCertificatePassword .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 にインストールされます。

Note

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

Note

接続が切断された場合のシナリオでは、必要な 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 セッションを終了します。

次のステップ

SQL リソース プロバイダーの維持