Skip to content

[BUG] SDK is not accessible via PowerShell 7.X only 5.1  #1343

Description

Describe the bug
Running power shell scripts using imports do not work in PowerShell 7.x only 5.1. The following works fine on the same machine in 5.1 but not 7.x.

Area/Component:
SDK with PowerShell 7.x

To Reproduce
Steps to reproduce the behavior:

  1. Open powershell in version 7.x
  2. Run the following
$RegKey = "HKLM:\SOFTWARE\Microsoft\Service Fabric SDK"
$ModuleFolderPath = (Get-ItemProperty -Path $RegKey -Name FabricSDKPSModulePath).FabricSDKPSModulePath
Import-Module "$ModuleFolderPath\ServiceFabricSDK.psm1"

Connect-ServiceFabricCluster localhost:19000 | Out-Null

Test two

  1. Open powershell in version 7.x
  2. Run the following Get-Command *ServiceFabricCluster* -All
  3. Open powershell in version 5.1
  4. Run the following Get-Command *ServiceFabricCluster* -All
    Notice 5.1 has all the expected commands and 7.x does not.

Expected behavior
In 5.1

PS C:\code> Get-Command *ServiceFabricCluster* -All


CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Add-AzureRmServiceFabricClusterCertificate         0.3.4      AzureRM.ServiceFabric
Cmdlet          Connect-ServiceFabricCluster                       3.1.0.0    ServiceFabric
Cmdlet          Copy-ServiceFabricClusterPackage                   3.1.0.0    ServiceFabric
Cmdlet          Get-AzureRmServiceFabricCluster                    0.3.4      AzureRM.ServiceFabric
Cmdlet          Get-ServiceFabricClusterConfiguration              3.1.0.0    ServiceFabric
Cmdlet          Get-ServiceFabricClusterConfigurationUpgradeStatus 3.1.0.0    ServiceFabric
Cmdlet          Get-ServiceFabricClusterConnection                 3.1.0.0    ServiceFabric
Cmdlet          Get-ServiceFabricClusterHealth                     3.1.0.0    ServiceFabric
Cmdlet          Get-ServiceFabricClusterHealthChunk                3.1.0.0    ServiceFabric
Cmdlet          Get-ServiceFabricClusterLoadInformation            3.1.0.0    ServiceFabric
Cmdlet          Get-ServiceFabricClusterManifest                   3.1.0.0    ServiceFabric
Cmdlet          Get-ServiceFabricClusterUpgrade                    3.1.0.0    ServiceFabric
Cmdlet          New-AzureRmServiceFabricCluster                    0.3.4      AzureRM.ServiceFabric
Cmdlet          New-ServiceFabricCluster                           3.1.0.0    ServiceFabric
Cmdlet          Register-ServiceFabricClusterPackage               3.1.0.0    ServiceFabric
Cmdlet          Remove-AzureRmServiceFabricClusterCertificate      0.3.4      AzureRM.ServiceFabric
Cmdlet          Remove-ServiceFabricCluster                        3.1.0.0    ServiceFabric
Cmdlet          Remove-ServiceFabricClusterPackage                 3.1.0.0    ServiceFabric
Cmdlet          Resume-ServiceFabricClusterUpgrade                 3.1.0.0    ServiceFabric
Cmdlet          Send-ServiceFabricClusterHealthReport              3.1.0.0    ServiceFabric
Cmdlet          Start-ServiceFabricClusterConfigurationUpgrade     3.1.0.0    ServiceFabric
Cmdlet          Start-ServiceFabricClusterRollback                 3.1.0.0    ServiceFabric
Cmdlet          Start-ServiceFabricClusterUpgrade                  3.1.0.0    ServiceFabric
Cmdlet          Test-ServiceFabricClusterConnection                3.1.0.0    ServiceFabric
Cmdlet          Test-ServiceFabricClusterManifest                  3.1.0.0    ServiceFabric
Cmdlet          Test-ServiceFabricClusterUpgrade                   3.1.0.0    ServiceFabric
Cmdlet          Unregister-ServiceFabricClusterPackage             3.1.0.0    ServiceFabric
Cmdlet          Update-ServiceFabricClusterUpgrade                 3.1.0.0    ServiceFabric

Observed behavior:

PS C:\code> Get-Command *ServiceFabricCluster* -All

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Add-AzureRmServiceFabricClusterCertificate         0.3.4      AzureRM.ServiceFabric
Cmdlet          Get-AzureRmServiceFabricCluster                    0.3.4      AzureRM.ServiceFabric
Cmdlet          New-AzureRmServiceFabricCluster                    0.3.4      AzureRM.ServiceFabric
Cmdlet          Remove-AzureRmServiceFabricClusterCertificate      0.3.4      AzureRM.ServiceFabric
The term 'Connect-ServiceFabricCluster' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a
     | path was included, verify that the path is correct and try again.

Service Fabric Runtime Version:
Microsoft Azure Service Fabric 8.2.1571.9590
Microsoft Azure Service Fabric SDK 5.2.1571.9590

Environment:

  • Microsoft Windows 10 Enterprise
  • Version 10.0.19044 Build 19044
  • System Type x64-based PC

Additional context
PowerShell 7.x is coming directly from the Windows Store. Running these in VS Code terminals.
Version: 1.66.2 (system setup)
Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977
Date: 2022-04-11T07:46:01.075Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Windows_NT x64 10.0.19044


Assignees: /cc @microsoft/service-fabric-triage

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions