microsoft / service-fabric

Service Fabric is a distributed systems platform for packaging, deploying, and managing stateless and stateful distributed applications and containers at large scale.
https://docs.microsoft.com/en-us/azure/service-fabric/
MIT License
3.03k stars 401 forks source link

Service Fabric Runtime fails to install when run under SYSTEM by the PowerShell Execution Policy check #1419

Open Naut-Code opened 1 year ago

Naut-Code commented 1 year ago

Service Fabric Runtime fails to install when run under SYSTEM by the PowerShell Execution Policy check

Service Fabric Runtime checks that the ExecutionPolicy for the Current User is set to RemoteSigned and will attempt to set it if this is not the case. I'm installing Service Fabric Runtime in Azure Image Builder and our user context is running under SYSTEM with no signed in user, the execution policy is Undefined and cannot be set.

PS> .\MicrosoftServiceFabric.exe /accepteula /quiet /SkipPSExecutionPolicy

2/2/2023 12:44:13 AM,Info,Installing Service Fabric Runtime. Logs written to C:\Windows\TEMP\InstallFabricRuntime_638108954534536827.log
2/2/2023 12:44:13 AM,Info,Running extract in parallel.
2/2/2023 12:44:13 AM,Info,Unpackaging autoextractor...
2/2/2023 12:44:13 AM,Info,2/2/2023 12:44:13 AM Running Process: powershell.exe -NoProfile -Command Get-ExecutionPolicy -Scope CurrentUser with timeout 00:01:00
2/2/2023 12:44:13 AM,Info,Current Powershell Execution Policy: Undefined
2/2/2023 12:44:13 AM,Info,Powershell Execution Policy of CurrentUser is Undefined, needs to set it to RemoteSigned...
2/2/2023 12:44:13 AM,Info,2/2/2023 12:44:13 AM Running Process: powershell.exe -NoProfile -Command Set-ExecutionPolicy RemoteSigned -Scope CurrentUser with timeout 00:01:00
2/2/2023 12:44:14 AM,Error,Unable to set Powershell Execution Policy of CurrentUser to RemoteSigned. 1

There appears to be a flag on the installer /SkipPSExecutionPolicy Execution policy changes may not work when running as SYSTEM. This is a bypass flag. but I get this error even with this flag across multiple versions of the installer.

Service Fabric Runtime Versions tested: 8.2.1571.9590, 9.1.1436.9590

Windows Server 2019 Datacenter

Hosted on Azure