Dela via


Ta bort ett program från ett Service Fabric-kluster med PowerShell

Det här exempelskriptet tar bort en Service Fabric-programinstans som körs och avregistrerar en programtyp och version från klustret. Om du tar bort en programinstans raderas även de tjänstinstanser som körs som associeras med det programmet. Anpassa parametrarna efter behov.

Installera, om så behövs, Service Fabric PowerShell-modulen installeras med Service Fabric SDK.

Exempelskript

# Variables
$endpoint = 'mysftestcluster.southcentralus.cloudapp.azure.com:19000'
$thumbprint = '2779F0BB9A969FB88E04915FFE7955D0389DA7AF'
$packagepath="C:\Users\sfuser\Documents\Visual Studio 2017\Projects\MyApplication\MyApplication\pkg\Release"

# Connect to the cluster using a client certificate.
Connect-ServiceFabricCluster -ConnectionEndpoint $endpoint `
          -KeepAliveIntervalInSec 10 `
          -X509Credential -ServerCertThumbprint $thumbprint `
          -FindType FindByThumbprint -FindValue $thumbprint `
          -StoreLocation CurrentUser -StoreName My

# Remove an application instance
Remove-ServiceFabricApplication -ApplicationName fabric:/MyApplication

# Unregister the application type
Unregister-ServiceFabricApplicationType -ApplicationTypeName MyApplicationType -ApplicationTypeVersion 1.0.0

Förklaring av skript

Det här skriptet använder följande kommandon. Varje kommando i tabellen länkar till kommandospecifik dokumentation.

Kommando Kommentarer
Remove-ServiceFabricApplication Tar bort en Service Fabric-programinstans som körs från klustret.
Avregistrera ServiceFabricApplicationType Avregistrerar en Service Fabric-programtyp och version från klustret.

Nästa steg

Mer information om Service Fabric PowerShell-modulen finns i Azure PowerShell dokumentation.

Ytterligare PowerShell-exempel för Azure Service Fabric finns i Azure PowerShell exempel.