Azure Stack Edge Pro GPU デバイスの VM にパスワード リセット拡張機能をインストールする

適用対象:Yes for Pro GPU SKUAzure Stack Edge Pro - GPUYes for Pro 2 SKUAzure Stack Edge Pro 2Yes for Pro R SKUAzure Stack Edge Pro RYes for Mini R SKUAzure Stack Edge Mini R

この記事では、Windows と Linux 両方の VM で Azure Resource Manager テンプレートを使ってパスワード リセット拡張機能をインストール、検証、削除するための手順について説明します。

前提条件

デバイスで実行されている VM にパスワード リセット拡張機能をインストールする前に:

  1. 1 つ以上の VM をデプロイした Azure Stack Edge デバイスにアクセスできることを確認します。 詳しくは、「Azure portal を使用して Azure Stack Edge Pro GPU デバイスに VM をデプロイする」をご覧ください。

    次の例では、コンピューティング ネットワークを有効にするためにポート 2 が使われています。 環境に Kubernetes がデプロイされていない場合は、Kubernetes ノード IP と外部サービス IP の割り当てをスキップできます。

    Screenshot of the Advanced networking pane for an Azure Stack Edge device. Network settings for Port 2 are highlighted.

  2. お使いのクライアント コンピューターにテンプレートをダウンロードします。 作業ディレクトリとして使用するディレクトリにファイルを解凍します。

  3. デバイスへのアクセスに使うクライアントが、Azure PowerShell 経由でローカル環境の Azure Resource Manager に接続されていることを確認します。 詳細な手順については、「Azure Stack Edge デバイスで Azure Resource Manager に接続する」を参照してください。

    Azure Stack Edge デバイスが再起動されると、Azure Resource Manager への接続は 1.5 時間ごとに有効期限が切れます。 接続の有効期限が切れた場合、実行するすべてのコマンドレットで、Azure に接続されていないことを示すエラー メッセージが返されます。 この場合は、もう一度サインインします。

パラメーター ファイルを編集する

VM のオペレーティング システムに応じて、Windows 用または Linux 用の拡張機能をインストールできます。 パラメーター ファイルとテンプレート ファイルは PasswordResetExtension フォルダーにあります。

既存の VM 用のパスワードを変更するには、addPasswordResetExtensionTemplate.parameters.json パラメーター ファイルを編集してから、テンプレート addPasswordResetExtensionTemplate.json をデプロイします。

addPasswordResetExtensionTemplate.parameters.json ファイルでは、次のパラメーターを受け取ります。

{ 
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", 
  "contentVersion": "1.0.0.0", 
  "parameters": { 
      "vmName": { 
          "value": "<Name of the VM>" 
      }, 
      "extensionType": { 
          "value": "<OS type of the VM, for example, Linux or Windows>" 
      }, 
      "username": { 
          "value": "<Existing username for connecting to your VM>" 
      }, 
      "Password": { 
          "value": "<New password for the user>" 
      } 
  } 
} 

テンプレートのデプロイ

パラメーターを設定する。 次のコマンドを実行します。

$templateFile = "<Path to addPasswordResetExtensionTemplate.json file>" 
$templateParameterFile = "<Path to addPasswordResetExtensionTemplate.parameters.json file>" 
$RGName = "<Name of resource group>" 
New-AzResourceGroupDeployment -ResourceGroupName $RGName -TemplateFile $templateFile -TemplateParameterFile $templateParameterFile -Name "<Deployment name>" -AsJob

拡張機能のデプロイは長時間実行されるジョブであり、完了するまでに約 10 分かかります。

出力例を次に示します。

PS C:\WINDOWS\system32> $templateFile = "C:\PasswordResetVmExtensionTemplates\addPasswordResetExtensionTemplate.json" 
PS C:\WINDOWS\system32> $templateParameterFile = "C:\PasswordResetVmExtensionTemplates\addPasswordResetExtensionTemplate.parameters.json" 
PS C:\WINDOWS\system32> $RGName = "myasepro2rg" 
PS C:\WINDOWS\system32> New-AzResourceGroupDeployment -ResourceGroupName $RGName -TemplateFile $templateFile -TemplateParameterFile $templateParameterFile -Name "windowsvmdeploy" -AsJob
Id     Name            PSJobTypeName   State         HasMoreData     Location             Command 
--     ----            -------------   -----         -----------     --------             ------- 
9      Long Running... AzureLongRun... Running       True            localhost            New-AzResourceGro... 
 
PS C:\WINDOWS\system32>

デプロイの追跡

特定の VM の拡張機能のデプロイ状態を確認するには、次のコマンドを実行します。

Get-AzVMExtension -ResourceGroupName <MyResourceGroup> -VMName <MyWindowsVM> -Name <Name of the extension>

出力例を次に示します。

PS C:\WINDOWS\system32> 
Get-AzVMExtension -ResourceGroupName myasepro2rg -VMName mywindowsvm -Name windowsVMAccessExt 
 
ResourceGroupName       : myasepro2rg 
VMName                  : mywindowsvm 
Name                    : windowsVMAccessExt 
Location                : dbelocal 
Etag                    : null 
Publisher               : Microsoft.Compute 
ExtensionType           : VMAccessAgent 
TypeHandlerVersion      : 2.4 
Id                      : /subscriptions/04a485ed-7a09-44ab-6671-66db7f111122/resourceGroups/myasepro2rg/provi 
                          ders/Microsoft.Compute/virtualMachines/mywindowsvm/extensions/windowsVMAccessExt 
PublicSettings          : { 
                            "username": "azureuser" 
                          } 
ProtectedSettings       : 
ProvisioningState       : Succeeded 
Statuses                : 
SubStatuses             : 
AutoUpgradeMinorVersion : True 
ForceUpdateTag          : 
  
PS C:\WINDOWS\system32>

拡張機能が正常にインストールされると、次のように表示されます。

Screenshot of the VM details pane with call-outs for the network interface and installed extensions on Windows.

更新された VM パスワードを確認する

VM のパスワードの更新を確認するには、新しいパスワードを使って VM に接続します。 手順について詳しくは、「Windows VM に接続する」をご覧ください。

Screenshot of the Remote Desktop Connection dialog to connect to a VM.

拡張機能を削除する

パスワード リセット拡張機能を削除するには、次のコマンドを実行します。

Remove-AzVMExtension -ResourceGroupName <Resource group name> -VMName <VM name> -Name <Name of the extension>

出力例を次に示します。

PS C:\WINDOWS\system32> Remove-AzVMExtension -ResourceGroupName myasepro2rg -VMName mywindowsvm5 -Name windowsVMAccessExt 
  
Virtual machine extension removal operation 
This cmdlet will remove the specified virtual machine extension. Do you want to continue? 
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Yes 
  
RequestId IsSuccessStatusCode StatusCode ReasonPhrase 
--------- ------------------- ---------- ------------ 
          True                OK         OK 
  
PS C:\WINDOWS\system32>

次のステップ

具体的には、次の方法を学習します。