#Register PSGallery as a trusted repo
Register-PSRepository -Default -InstallationPolicy Trusted
#Install Arc registration script from PSGallery
Install-Module AzsHCI.ARCinstaller
#Install required PowerShell modules in your node for registration
Install-Module Az.Accounts -Force
Install-Module Az.ConnectedMachine -Force
Install-Module Az.Resources -Force
インストールの出力例を次に示します。
PS C:\Users\SetupUser> Install-Module -Name AzSHCI.ARCInstaller
NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\SetupUser\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
PS C:\Users\SetupUser>
PS C:\Users\SetupUser> Install-Module Az.Accounts -Force
PS C:\Users\SetupUser> Install-Module Az.ConnectedMachine -Force
PS C:\Users\SetupUser> Install-Module Az.Resources -Force
パラメーターを設定します。 スクリプトは、次のパラメーターを受け取ります。
パラメーター
説明
SubscriptionID
サーバーを Azure Arc に登録するために使用されるサブスクリプションの ID。
TenantID
サーバーを Azure Arc に登録するために使用されるテナント ID。Microsoft Entra IDに移動し、テナント ID プロパティをコピーします。
#Define the subscription where you want to register your server as Arc device
$Subscription = "YourSubscriptionID"
#Define the resource group where you want to register your server as Arc device
$RG = "YourResourceGroupName"
#Define the region you will use to register your server as Arc device
$Region = "eastus"
#Define the tenant you will use to register your server as Arc device
$Tenant = "YourTenantID"
#Connect to your Azure account and Subscription
Connect-AzAccount -SubscriptionId $Subscription -TenantId $Tenant -DeviceCode
#Get the Access Token for the registration
$ARMtoken = (Get-AzAccessToken).Token
#Get the Account ID for the registration
$id = (Get-AzContext).Account.Id
サブスクリプションと認証の設定のサンプル出力を次に示します。
PS C:\Users\SetupUser> Connect-AzAccount -SubscriptionId $Subscription -TenantId $Tenant -DeviceCode
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code A44KHK5B5
to authenticate.
Account SubscriptionName TenantId Environment
------- ---------------- -------- -----------
guspinto@contoso.com AzureStackHCI_Content <Tenant ID> AzureCloud
PS C:\Users\SetupUser> $ARMtoken = (Get-AzAccessToken).Token
PS C:\Users\SetupUser> $id = (Get-AzContext).Account.Id
#Invoke the registration script. Use a supported region.
Invoke-AzStackHciArcInitialization -SubscriptionID $Subscription -ResourceGroup $RG -TenantID $Tenant -Region $Region -Cloud "AzureCloud" -ArmAccessToken $ARMtoken -AccountID $id
プロキシ サーバー経由でインターネットにアクセスする場合は、 パラメーターを渡 -proxy し、スクリプトの実行時と同様 http://<Proxy server FQDN or IP address>:Port にプロキシ サーバーを指定する必要があります。
サーバーの正常な登録のサンプル出力を次に示します。
PS C:\DeploymentPackage> Invoke-AzStackHciArcInitialization -SubscriptionID $Subscription -ResourceGroup $RG -TenantID $Tenant -Region $Region -Cloud "AzureCloud" -ArmAccessToken $ARMtoken -AccountID $id -Force
Installing and Running Azure Stack HCI Environment Checker
All the environment validation checks succeeded
Installing Hyper-V Management Tools
Starting AzStackHci ArcIntegration Initialization
Installing Azure Connected Machine Agent
Total Physical Memory: 588,419 MB
PowerShell version: 5.1.25398.469
.NET Framework version: 4.8.9032
Downloading agent package from https://aka.ms/AzureConnectedMachineAgent to C:\Users\AzureConnectedMachineAgent.msi
Installing agent package
Installation of azcmagent completed successfully
0
Connecting to Azure using ARM Access Token
Connected to Azure successfully
Microsoft.HybridCompute RP already registered, skipping registration
Microsoft.GuestConfiguration RP already registered, skipping registration
Microsoft.HybridConnectivity RP already registered, skipping registration
Microsoft.AzureStackHCI RP already registered, skipping registration
INFO Connecting machine to Azure... This might take a few minutes.
INFO Testing connectivity to endpoints that are needed to connect to Azure... This might take a few minutes.
20% [==> ]
30% [===> ]
INFO Creating resource in Azure...
Correlation ID=<Correlation ID>=/subscriptions/<Subscription ID>/resourceGroups/myashci-rg/providers/Microsoft.HybridCompute/machines/ms309
60% [========> ]
80% [===========> ]
100% [===============]
INFO Connected machine to Azure
INFO Machine overview page: https://portal.azure.com/
Connected Azure ARC agent successfully
Successfully got the content from IMDS endpoint
Successfully got Object Id for Arc Installation <Object ID>
$Checking if Azure Stack HCI Device Management Role is assigned already for SPN with Object ID: <Object ID>
Assigning Azure Stack HCI Device Management Role to Object : <Object ID>
$Successfully assigned Azure Stack HCI Device Management Role to Object Id <Object ID>
Successfully assigned permission Azure Stack HCI Device Management Service Role to create or update Edge Devices on the resource group
$Checking if Azure Connected Machine Resource Manager is assigned already for SPN with Object ID: <Object ID>
Assigning Azure Connected Machine Resource Manager to Object : <Object ID>
$Successfully assigned Azure Connected Machine Resource Manager to Object Id <Object ID>
Successfully assigned the Azure Connected Machine Resource Manager role on the resource group
$Checking if Reader is assigned already for SPN with Object ID: <Object ID>
Assigning Reader to Object : <Object ID>
$Successfully assigned Reader to Object Id <Object ID>
Successfully assigned the reader Resource Manager role on the resource group
Installing TelemetryAndDiagnostics Extension
Successfully triggered TelemetryAndDiagnostics Extension installation
Installing DeviceManagement Extension
Successfully triggered DeviceManagementExtension installation
Installing LcmController Extension
Successfully triggered LCMController Extension installation
Please verify that the extensions are successfully installed before continuing...
Log location: C:\Users\Administrator\.AzStackHci\AzStackHciEnvironmentChecker.log
Report location: C:\Users\Administrator\.AzStackHci\AzStackHciEnvironmentReport.json
Use -Passthru parameter to return results as a PSObject.