@@ -2367,43 +2367,49 @@ param(
2367
2367
2368
2368
if ($ArcCmdletsAbsentOnNodes.Count -ge 1 )
2369
2369
{
2370
- $ArcCmdletsNotAvailableErrorMsg = $ArcCmdletsNotAvailableError -f ($ArcCmdletsAbsentOnNodes -join " ," )
2371
- Write-Error - Message $ArcCmdletsNotAvailableErrorMsg
2372
- $registrationOutput | Add-Member - MemberType NoteProperty - Name $OutputPropertyResult - Value [OperationStatus ]::Failed
2373
- Write-Output $registrationOutput
2374
- return
2375
- }
2376
-
2377
- $arcResourceId = $resourceId + $HCIArcInstanceName
2378
- $arcResourceGroupName = $ResourceGroupName
2379
-
2380
- $arcres = Get-AzResource - ResourceId $arcResourceId - ApiVersion $HCIArcAPIVersion - ErrorAction Ignore
2381
-
2382
- if ($arcres -eq $null )
2383
- {
2384
- $arcres = New-AzResource - ResourceId $arcResourceId - ApiVersion $HCIArcAPIVersion - Force
2385
- }
2386
- else
2387
- {
2388
- if ($arcres.Properties.aggregateState -eq $ArcSettingsDisableInProgressState )
2370
+ # Show Arc error on 20h2 only if -EnableAzureArcServer:$true is explicity passed by user
2371
+ if ($PSBoundParameters.ContainsKey (' EnableAzureArcServer' ))
2389
2372
{
2390
- Write-Error - Message $ArcRegistrationDisableInProgressError
2373
+ $ArcCmdletsNotAvailableErrorMsg = $ArcCmdletsNotAvailableError -f ($ArcCmdletsAbsentOnNodes -join " ," )
2374
+ Write-Error - Message $ArcCmdletsNotAvailableErrorMsg
2391
2375
$registrationOutput | Add-Member - MemberType NoteProperty - Name $OutputPropertyResult - Value [OperationStatus ]::Failed
2392
2376
Write-Output $registrationOutput
2393
2377
return
2394
2378
}
2395
2379
}
2380
+ else
2381
+ {
2382
+ $arcResourceId = $resourceId + $HCIArcInstanceName
2383
+ $arcResourceGroupName = $ResourceGroupName
2396
2384
2397
- $arcResourceGroupName = $arcres.Properties.arcInstanceResourceGroup
2398
- $arcAppName = $ResourceName + " .arc"
2385
+ $arcres = Get-AzResource - ResourceId $arcResourceId - ApiVersion $HCIArcAPIVersion - ErrorAction Ignore
2399
2386
2400
- Write-Verbose " Register-AzStackHCI: Arc registration triggered. ArcResourceGroupName: $arcResourceGroupName "
2401
- $arcResult = Register-ArcForServers - IsManagementNode $IsManagementNode - ComputerName $ComputerName - Credential $Credential - TenantId $TenantId - SubscriptionId $SubscriptionId - ResourceGroup $arcResourceGroupName - Region $Region - AppName $arcAppName - ClusterDNSSuffix $clusterDNSSuffix - IsWAC:$IsWAC
2387
+ if ($arcres -eq $null )
2388
+ {
2389
+ $arcres = New-AzResource - ResourceId $arcResourceId - ApiVersion $HCIArcAPIVersion - Force
2390
+ }
2391
+ else
2392
+ {
2393
+ if ($arcres.Properties.aggregateState -eq $ArcSettingsDisableInProgressState )
2394
+ {
2395
+ Write-Error - Message $ArcRegistrationDisableInProgressError
2396
+ $registrationOutput | Add-Member - MemberType NoteProperty - Name $OutputPropertyResult - Value [OperationStatus ]::Failed
2397
+ Write-Output $registrationOutput
2398
+ return
2399
+ }
2400
+ }
2402
2401
2403
- if ($arcResult -ne [ErrorDetail ]::Success)
2404
- {
2405
- $operationStatus = [OperationStatus ]::RegisterSucceededButArcFailed
2406
- $registrationOutput | Add-Member - MemberType NoteProperty - Name $OutputPropertyErrorDetail - Value $arcResult
2402
+ $arcResourceGroupName = $arcres.Properties.arcInstanceResourceGroup
2403
+ $arcAppName = $ResourceName + " .arc"
2404
+
2405
+ Write-Verbose " Register-AzStackHCI: Arc registration triggered. ArcResourceGroupName: $arcResourceGroupName "
2406
+ $arcResult = Register-ArcForServers - IsManagementNode $IsManagementNode - ComputerName $ComputerName - Credential $Credential - TenantId $TenantId - SubscriptionId $SubscriptionId - ResourceGroup $arcResourceGroupName - Region $Region - AppName $arcAppName - ClusterDNSSuffix $clusterDNSSuffix - IsWAC:$IsWAC
2407
+
2408
+ if ($arcResult -ne [ErrorDetail ]::Success)
2409
+ {
2410
+ $operationStatus = [OperationStatus ]::RegisterSucceededButArcFailed
2411
+ $registrationOutput | Add-Member - MemberType NoteProperty - Name $OutputPropertyErrorDetail - Value $arcResult
2412
+ }
2407
2413
}
2408
2414
}
2409
2415
0 commit comments