Skip to content

Commit db0f0b2

Browse files
authored
[StackHCI] Add Check for ARC extension in Remote Support Cmdlets (#22400)
* add ARC check in remote support cmdlets * add more info in logging
1 parent 95a0e0e commit db0f0b2

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

src/StackHCI/custom/stackhci.ps1

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5563,8 +5563,12 @@ function Install-AzStackHCIRemoteSupport{
55635563
param()
55645564

55655565
Setup-Logging -LogFilePrefix "AzStackHCIRemoteSupportInstall" -DebugEnabled ($DebugPreference -ne "SilentlyContinue")
5566-
if(Assert-IsObservabilityStackPresent){
5567-
Write-InfoLog("Install-AzStackHCIRemoteSupport is not available.")
5566+
5567+
$agentInstallType = (Get-ItemProperty -Path "HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" -ErrorAction SilentlyContinue).InstallType
5568+
$observabilityStackPresent = Assert-IsObservabilityStackPresent
5569+
5570+
if($observabilityStackPresent -or ($agentInstallType -eq "ArcExtension")){
5571+
Write-InfoLog("Install-AzStackHCIRemoteSupport is not available. Observability Stack Present: <$observabilityStackPresent>. Agent install type: <$agentInstallType>")
55685572
}
55695573
else{
55705574
Install-DeployModule -ModuleName "Microsoft.AzureStack.Deployment.RemoteSupport"
@@ -5590,8 +5594,11 @@ function Remove-AzStackHCIRemoteSupport{
55905594
param()
55915595

55925596
Setup-Logging -LogFilePrefix "AzStackHCIRemoteSupportRemove" -DebugEnabled ($DebugPreference -ne "SilentlyContinue")
5593-
if(Assert-IsObservabilityStackPresent){
5594-
Write-InfoLog("Remove-AzStackHCIRemoteSupport is not available.")
5597+
$agentInstallType = (Get-ItemProperty -Path "HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" -ErrorAction SilentlyContinue).InstallType
5598+
$observabilityStackPresent = Assert-IsObservabilityStackPresent
5599+
5600+
if($observabilityStackPresent -or ($agentInstallType -eq "ArcExtension")){
5601+
Write-InfoLog("Remove-AzStackHCIRemoteSupport is not available. Observability Stack Present: <$observabilityStackPresent>. Agent install type: <$agentInstallType>")
55955602
}
55965603
else{
55975604
Install-DeployModule -ModuleName "Microsoft.AzureStack.Deployment.RemoteSupport"
@@ -5659,7 +5666,10 @@ function Enable-AzStackHCIRemoteSupport{
56595666
}
56605667
}
56615668

5662-
if(Assert-IsObservabilityStackPresent){
5669+
$agentInstallType = (Get-ItemProperty -Path "HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" -ErrorAction SilentlyContinue).InstallType
5670+
$observabilityStackPresent = Assert-IsObservabilityStackPresent
5671+
5672+
if($observabilityStackPresent -or ($agentInstallType -eq "ArcExtension")){
56635673
Import-Module DiagnosticsInitializer -Force
56645674
Enable-RemoteSupport -AccessLevel $AccessLevel -ExpireInMinutes $ExpireInMinutes -SasCredential $SasCredential -AgreeToRemoteSupportConsent:$AgreeToRemoteSupportConsent
56655675
}
@@ -5687,7 +5697,10 @@ function Disable-AzStackHCIRemoteSupport{
56875697
[CmdletBinding(SupportsShouldProcess)]
56885698
[OutputType([Boolean])]
56895699
param()
5690-
if(Assert-IsObservabilityStackPresent){
5700+
$agentInstallType = (Get-ItemProperty -Path "HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" -ErrorAction SilentlyContinue).InstallType
5701+
$observabilityStackPresent = Assert-IsObservabilityStackPresent
5702+
5703+
if($observabilityStackPresent -or ($agentInstallType -eq "ArcExtension")){
56915704
Import-Module DiagnosticsInitializer -Force
56925705
Disable-RemoteSupport
56935706
}
@@ -5729,7 +5742,10 @@ function Get-AzStackHCIRemoteSupportAccess{
57295742
$IncludeExpired
57305743
)
57315744

5732-
if(Assert-IsObservabilityStackPresent){
5745+
$agentInstallType = (Get-ItemProperty -Path "HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" -ErrorAction SilentlyContinue).InstallType
5746+
$observabilityStackPresent = Assert-IsObservabilityStackPresent
5747+
5748+
if($observabilityStackPresent -or ($agentInstallType -eq "ArcExtension")){
57335749
Import-Module DiagnosticsInitializer -Force
57345750
Get-RemoteSupportAccess -IncludeExpired:$IncludeExpired
57355751
}
@@ -5820,7 +5836,10 @@ function Get-AzStackHCIRemoteSupportSessionHistory{
58205836
$FromDate = (Get-Date).AddDays(-7)
58215837
)
58225838

5823-
if(Assert-IsObservabilityStackPresent){
5839+
$agentInstallType = (Get-ItemProperty -Path "HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" -ErrorAction SilentlyContinue).InstallType
5840+
$observabilityStackPresent = Assert-IsObservabilityStackPresent
5841+
5842+
if($observabilityStackPresent -or ($agentInstallType -eq "ArcExtension")){
58245843
Import-Module DiagnosticsInitializer -Force
58255844
Get-RemoteSupportSessionHistory -SessionId $SessionId -FromDate $FromDate -IncludeSessionTranscript:$IncludeSessionTranscript
58265845
}

0 commit comments

Comments
 (0)