This article is contributed. See the original author and article here.


AzureRM PowerShell modules would be retired on 29 February 2024, Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules.   


This blog shows AZ module setup and common commands to manage your Azure Service Fabric. 


 


Table of Contents 



  • Az module setup: 

    • Check if you have AzureRM module 

    • Install AZ module and remove AzureRM module 



  • Common commands 

    • Login to your Azure account   

    • Get service fabric cluster status

    • Add nodes to a cluster 

    • Add nodeType to cluster 

    • Update cluster durability 

    • Update the cluster reliability 




Notes: 



  1. The following cmdlets of {Get-Az*} only support ARM deployed resources: 



  • Get-AzServiceFabricApplication 

  • Get-AzServiceFabricService 

  • Get-AzServiceFabricApplicationTypeVersion 

  • Get-AzServiceFabricApplicationType 



  1.  Add cluster certificate is not supported, suggest to use ARM instead. 


hailey_ding_0-1617006540556.png


 


Az module setup: 


This section will cover how to setup the AZ module in your environment. 


You can skip this part, If you have already setup a local environment for with the AZ module. 


 


Step 1: check if you have AzureRM module.  


Iyou do have the AzureRM installed, you will need to remove AzureRM module first 


Document Link 


 


Run code:  


 


 

if ($PSVersionTable.PSEdition -eq 'Desktop' -and (Get-Module -Name AzureRM -ListAvailable)) { 

    Write-Warning -Message ('Az module not installed. Having both the AzureRM and ' + 

      'Az modules installed at the same time is not supported.') 

} else { 

    Install-Module -Name Az -AllowClobber -Scope CurrentUser 

} 

 


 


hailey_ding_1-1617006540546.png


 


Step2: install AZ module and remove AzureRM module 


Uninstall AzureRM module: https://docs.microsoft.com/en-us/powershell/azure/uninstall-az-ps?view=azps-5.6.0#option-2-uninstall-the-azurerm-powershell-module-from-powershellget 


 


First run code:  


 


 

Install-Module -Name Az -AllowClobber -Scope CurrentUser 

 


 


hailey_ding_2-1617006540527.png


 


Then run code as an admin: 


 


 

Uninstall-AzureRm 

 


 


hailey_ding_3-1617006540529.png


 


Common commands 


 



  • Login to your Azure account 


To login, you will need to run the following command:


 


 

Connect-AzAccount 

 


 


hailey_ding_4-1617006540530.png


 


After sign in, you will be able to see the subscriptions you can work with: 


hailey_ding_5-1617006540532.png


 


 (Optional) If you want to change a subscription to work with, run the following codes: 


Run code: 


 


 

$context = Get-AzSubscription -SubscriptionId ... 
Set-AzContext $context 

 


 


 


 



Use the Get-AzServiceFabricCluster command to get the information for a specific SF cluster. 


Run code: 


 


 

Get-AzServiceFabricCluster -ResourceGroupName 'haileyservicefabrictest' -ClusterName 'haileysftest' 

 


 


hailey_ding_6-1617006540561.png


 



You can run the following code to add nodes to your specific cluster


 


 

Add-AzureRmServiceFabricNode  -ResourceGroupName 'haileyservicefabrictest' -ClusterName 'haileysftest'  -NodeType 'Type456' -Number 2 

 


 


 



Run codes: 


 


 

Add-AzServiceFabricNodeType -ResourceGroupName $resourceGroupName -ClusterName $clusterName  -NodeType $nodeType  -Capacity $capacity  -VmUserName  $vmUsername -VmPassword $pwd 

 


 


 


hailey_ding_7-1617006540548.png


 



Using the following command to update the durability tier or VmSku of a node type in the cluster. 


 


 

Update-AzServiceFabricDurability -ResourceGroupName 'haileyservicefabrictest' -Name 'haileysftest' -DurabilityLevel Silver -NodeType 'mynodetype’ 

 


 


hailey_ding_8-1617006540551.png


 



Use the following command to update the reliability tier of the primary node type in a cluster. 


 


 

Update-AzServiceFabricReliability -ResourceGroupName 'haileyservicefabrictest' -Name 'haileysftest' -ReliabilityLevel Silver 

 


 


 


 

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.