-
Notifications
You must be signed in to change notification settings - Fork 0
/
SF_UndeployApplication.ps1
38 lines (28 loc) · 1.94 KB
/
SF_UndeployApplication.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
###################################################################################################
## REF: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-automate-powershell
###################################################################################################
Import-Module "$ENV:ProgramFiles\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1"
$imageStorePath = 'Voting'
$appTypeName = 'VotingType'
$appName = "fabric:/$imageStorePath"
$appVersion = '1.0.0'
$ServerCommonName = "CLUSTER_NAME.REGION.cloudapp.azure.com" #for azure hosted cluster deployments
#$ServerCommonName = "localhost" #for local hosted cluster deployments
$clusterAddress = "${ServerCommonName}:19000"
$thumb="YOUR_CERTIFICATE_THUMBPRINT" #for secured cluster hosted in Azure
# Connect to the Service Fabric cluster (need certificate for a secured cluster in Azure)
#Connect-ServiceFabricCluster $clusterAddress #for local cluster only
Connect-ServiceFabricCluster -ConnectionEndpoint $clusterAddress -X509Credential -ServerCertThumbprint $thumb -FindType FindByThumbprint -FindValue $thumb -StoreLocation CurrentUser -StoreName My
# Get all application types registered in the cluster
#Get-ServiceFabricApplicationType
# Get all application instances created in the cluster
#Get-ServiceFabricApplication -ApplicationName $appName
# Get all service instances for each application
#Get-ServiceFabricApplication -ApplicationName $appName | Get-ServiceFabricService
Write-Output "Removing application '${imageStorePath}' from cluster at '${clusterAddress}'..."
# Remove an application instance
Remove-ServiceFabricApplication $appName -Force #force flag skips prompt for confirmation
# Unregister the application type
Unregister-ServiceFabricApplicationType $appTypeName $appVersion
# Remove the application package
Remove-ServiceFabricApplicationPackage -ApplicationPackagePathInImageStore Voting