Skip to content

Commit 04a37e3

Browse files
Detection of Cloud Deployment Flow using registry key (#29053)
1 parent 45ee9bf commit 04a37e3

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,11 +2150,27 @@ function Verify-NodesArcRegistrationState{
21502150
}
21512151

21522152
function ValidateCloudDeployment {
2153-
if ($env:DEPLOYMENTTYPE -eq "cloud_deployment")
2154-
{
2155-
Write-VerboseLog "Cloud Deployment is enabled"
2153+
$regPath = "HKLM:\Software\Microsoft\AzureStackStampInformation"
2154+
$regName = "DeploymentLaunchType"
2155+
$cloudValue = "CloudDeployment"
2156+
# check environment variable
2157+
if ($env:DEPLOYMENTTYPE -eq "cloud_deployment") {
2158+
Write-VerboseLog "Cloud Deployment detected via environment variable"
21562159
return $true
21572160
}
2161+
# Check registry key set in Set-IdentifierForCloudDeployment by LCM Team
2162+
try {
2163+
if (Test-Path $regPath) {
2164+
$regValue = Get-ItemPropertyValue -Path $regPath -Name $regName -ErrorAction SilentlyContinue
2165+
if ($regValue -eq $cloudValue) {
2166+
Write-VerboseLog "Cloud Deployment detected via registry key"
2167+
return $true
2168+
}
2169+
}
2170+
}
2171+
catch {
2172+
Write-VerboseLog "Failed to read cloud deployment flag from registry: $($_.Exception.Message)"
2173+
}
21582174
Write-VerboseLog "Cloud Deployment is disabled, normal deployment"
21592175
return $false
21602176
}

src/StackHCI/StackHCI/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Improved cloud deployment detection during Azure Arc repair operations to prevent duplicate enablement attempts and ensure smoother deployment experiences.
2122

2223
## Version 2.6.5
2324
* ARC Enablement of Nodes Before Triggering Registration in New Registration Flow.

0 commit comments

Comments
 (0)