CLI Uninstall Service Fabric - azure-service-fabric

I'm having problems with Service Fabric that I can't figure out, so I will try a reinstall. However, I want to do this using the CLI, but I can't even find it in the list of installed packages;)
First trying Get-AppxPackage, which doesn't list either the SDK or the Runtime.
Get-AppxPackage –AllUsers
I also tried Get-WmiObject and this actually lists the SDK, but not the Runtime.
PS C:\Users\caec> Get-WmiObject -Class Win32_Product| Where-Object -Property Name -Match "Fabric"
IdentifyingNumber : {8D646D05-61C0-49AA-98C0-B92AAF1F9119}
Name : Microsoft Azure Service Fabric SDK
Vendor : Microsoft Corporation
Version : 6.1.1390.9590
Caption : Microsoft Azure Service Fabric SDK
If I look in installed Apps in Control Panel, I see both.
Any pointers?;)

I tried installing service fabric CLI in my Azure Bash environment and able to run it successfully after installation.
Install service fabric using below pip command.
Note: Make sure that you check the Python, Service Fabric as well as pip version compatibility.
pip install -I sfctl==11.2.0 //Latest version
Once it gets installed successfully, execute below command to check the runtime version & compatibility as shown:
sfctl --h
Executing below command will take you to the service fabric command line and sub commands.
sfctl
MSDoc for reference.

Related

WebPICMD Retired

Reading this article on WebPI from August, 2022, I would think WebPI was active, but now I get from the command line that it's retired.
Are there any alternatives to this?
I was trying to install Service Fabric:
PS C:\Users\caec> C:\"Program Files"\"Microsoft SDKs"\Azure\".NET SDK"\v2.9\bin\plugins\WebDeploy\WebpiCmd.exe /List /ListOption:All
The software that you obtain using the Web Platform Installer Command Line Tool is licensed to you by its owner. Microsoft grants you no rights for third party software.
Successfully loaded primary feed: https://aka.ms/webpifeed51
Current language of installers is English
There are no products available for Previously Installed Products
--Available Products
ID Title
----------------------------------------
WebPIRetired The Web Platform Installer is now officially retired
There are no products available for Applications
Are there any other ways to install Service Fabric with some kind of package manager?
I tried in my environment and installed the service fabric successfully .
Yes, the Web Platform Installer (WebPI) is retired on September 1, 2022 & no longer supported and has been removed. Using tools like PowerShell, NuGet, and Chocolatey, Microsoft has shifted to a more current package method.
You can install the service fabric cluster using PowerShell Gallery to download the Service Fabric SDK and related modules.
Open Powershell command prompt and run as administrator.
Command:
Install-Module -Name Az.ServiceFabric -RequiredVersion 3.1.0
Console:
Once its installation done, you can import the Service Fabric modules by running the following command:
Command:
Import-module -Name Az.ServiceFabric
Once imported you can use the get-module command to verify it is installed.
Another approach is Chocolatey package manager same as PowerShell run as administrator.
Command:
choco install service-fabric
Console:
Reference:
Chocolatey Software | Service Fabric 9.1.1390

AzurePS System capability is not available on a newly installed vsts-agent

I have successfully installed a new VSTS agent on a new Azure VM - Windows Server 2012 R2 (64bit). When I am try to execute any pipelines containing azure powershell tasks on the new vsts agent, I get an error message :-
Error message 'No agent found in pool BuildAgent2 which satisfies the specified demands:azureps Agent.Version -gtVersion 2.119.1'
Is there any way to add AzurePS as a system capability ?
Please advise on the steps to do this - thanks.
AzurePS System capability is not available on a newly installed vsts-agent
Agree with jessehouwing.
If you want to enable AzurePS System capability, you could install the PowerShell 5.1 or higher on Windows, or PowerShell Core 6.x and later on all platforms, then install/update the Azure PowerShell module on the Azure VM:
Install the Azure PowerShell module
But the error you got should more related to the demands you set on the option tab of your build :
Check the agent version you have installed, make sure you set the correct version, or you can try to remove that demands to check if you still have this issue.
Hope this helps.
I got the same error using the AzureFileCopy#4 task in a self-hosted agent, but I solved it by installing the az module https://www.powershellgallery.com/packages/Az
Install-Module -Name Az

Packer - Windows Server 2012R2 - Install PowerShell 5

I'm having trouble with installing PowerShell 5 on Windows Server 2012 R2 using Packer.
To install PowerShell 5.1, I'm using chocolatey
powershell
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
choco install PowerShell -y
I need to to do this for two packer builder:
Amazon Web Services EC2 AMI.
Hyper-V Vagrant.
With the Amazon Web Services EC2 AMI I've tried executing the above from the following locations
As part of the user_data_file script.
As an inline provision script.
I've added the windows-restart provision in the flow after the execution of the fragment.
Similarly I've tried the same with the Hyper-V Vagrant both as part of the Autounattend flow and as an inline provision.
In both cases the installation fails because the user profile is not created. At least I think that is the problem. As a reference, I've faced the exact same problem when installing sql server express.
Has anyone managed to accomplish this flow and what is your recommendation?
PowerShell package uses MSU (Windows Update file). There are a couple of considerations here:
Ensure Windows Updates Service is turned on. Chocolatey doesn't do that yet, although there is an issue filed.
MSUs must be run locally from the machine. So if you are running over WinRM, you instead need to have it set up a scheduled task to call choco install and then run it that way.
Yes, that second point is accurate. No, it is not Chocolatey's fault. That's a Microsoft design decision with MSU files. It's a real PITA.
FYI - BoxStarter handles it appropriately, and it can be used with Packer. You will find less pain if you look there.
HTH

Connect-ServiceFabricCluster : Argument 'Connect-ServiceFabricCluster' is not recognized as a cmdlet: Unable to load DLL 'FabricCommon.dll'

I installed Service Fabric by using the Install the Service Fabric runtime, SDK, and tools for Visual Studio 2015 Update 2 link from Prepare your development environment.
Trying to publish a Service Fabric Application fails with:
2>Connect-ServiceFabricCluster : Argument 'Connect-ServiceFabricCluster' is not recognized as a cmdlet: Unable to load
2>DLL 'FabricCommon.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Same error described in Troubleshoot your local development cluster setup, but it does not matter what PowerShell version I use, 64 or 32.
The Service Fabric SDK version I got is 2.1.163.
I am running Windows 10 10586 with Visual Studio 2015 Update 3.
FabricCommon.dll is located at c:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code\FabricCommon.dll
What am I missing?
I will focus on this error first:
DLL 'FabricCommon.dll': The specified module could not be found
You can fix this by re-installing the service fabric SDK. This happens to me before during installation and I thought it was fixed but you never know.
Also make sure you are using the same version of the SDK and nuget package that you referenced in your Service Fabric application.
A workaround for this issue (which does not include reinstall of the Service Fabric SDK) is to add the following to your path environment variable and restart the application which is throwing error (Visual Studio or PowerShell so that it can access the new environment variable):
C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code
You do not need to restart your computer, just restart the application after you have update the path environment variable. The dll fabricCommon.dll lives in this folder.
This workaround is inspired by (but is not identical to) the solution to a somewhat related issue presented here: https://social.msdn.microsoft.com/Forums/azure/en-US/6c8cc261-6c84-4097-be03-e8073cbc9397/unable-to-load-dll-fabricruntimedll?forum=AzureServiceFabric&prof=required
All I had to do is restart Visual Studio and it worked. This happens time to time.
Please Run Windows PowerShell as Administrator and then try.
I have experienced the same problem on my Win10 box, and even adding the relevant powershell module that contained necessary cmdlets didn't work. The solution that worked for me was: Control Panel -> "Programs and Features", uninstall Service Fabric SDK, then click "Turn Windows features on or off" link and uninstall PowerShell. Next, reboot Windows, back to Control Panel -> "Programs and Features" -> "Turn Windows features on or off", install PowerShell, after which download/install Service Fabric SDK. Again, restart the PC, start the Service Fabric Cluster Manager (if it doesn't auto-start), right-click its icon on the task-bar and try creating 1-node or 5-node cluster.
I was facing same issue on vs2017 and window server 2016. I reinstalled service fabric sdk and issue fixed.
I had similar issue after creating a cluster on windows server 2016.
In my scenario all I had to do was log out/in again and issue was fixed.
You could try restarting VM too - only if it still fails would I try re-installing the SDK.

FailoverClusters module is not getting listed while running the cmdlet Get-Module -ListAvailable

I tried below command
Get-Module -ListAvailable
But it did not showed me "FailoverClusters" in the list
From where I can download this module? Do I have to install any SDK?
Note: I do not want to install Azure SDK. Is there any other way?
Update
I am using my local windows 10 to remote connect to the Azure Virtual Machine (Windows Server 2012 R2). I do want to manage all configurations using powershell from my local windows 10 machine.
As jisaak already explained, the FailoverClusters module is installed when you install the Failover Clustering feature on a Windows Server.
If, however, you want to manage a cluster from a computer without the Failover Clustering feature installed, this is what you do:
Download the appropriate version of Remote Server Administration Tools
Run the installer
Navigate to the Programs and Features control panel pane (run appwiz.cpl)
Choose "Turn Windows Features on or off"
Find the "Failover Cluster Management" feature under Remote Server Administration Tools
Enable it
Voila
The FailoverClusters Windows PowerShell module is installed on the
computer with the Failover Clustering feature
Source
Install the Failover Clustering Feature