Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
This sample script copies an application package to a cluster image store, registers the application type in the cluster, removes the unnecessary application package, and creates an application instance from the application type. If any default services were defined in the application manifest of the target application type, then those services are created at this time. Pas de parameters indien nodig aan.
Installeer indien nodig de Service Fabric PowerShell-module met de Service Fabric SDK.
Voorbeeldscript
# 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
# Copy the application package to the cluster image store.
Copy-ServiceFabricApplicationPackage $packagepath -ImageStoreConnectionString fabric:ImageStore -ApplicationPackagePathInImageStore MyApplication
# Register the application type.
Register-ServiceFabricApplicationType -ApplicationPathInImageStore MyApplication
# Remove the application package to free system resources.
Remove-ServiceFabricApplicationPackage -ImageStoreConnectionString fabric:ImageStore -ApplicationPackagePathInImageStore MyApplication
# Create the application instance.
New-ServiceFabricApplication -ApplicationName fabric:/MyApplication -ApplicationTypeName MyApplicationType -ApplicationTypeVersion 1.0.0
Clean up deployment
After the script sample has been run, the script in Remove an application can be used to remove the application instance, unregister the application type, and delete the application package from the image store.
Uitleg van script
In dit script worden de volgende opdrachten gebruikt. Elke opdracht in de tabel bevat koppelingen naar opdrachtspecifieke documentatie.
| Opdracht | Opmerkingen |
|---|---|
| Connect-ServiceFabricCluster | Creates a connection to a Service Fabric cluster. |
| Copy-ServiceFabricApplicationPackage | Copies an application package to the cluster image store. |
| Register-ServiceFabricApplicationType | Registers an application type and version on the cluster. |
| New-ServiceFabricApplication | Creates an application from a registered application type. |
| Remove-ServiceFabricApplicationPackage | Verwijdert een Service Fabric-toepassingspakket uit de image store. |
Volgende stappen
Zie de Documentatie voor Azure PowerShell voor meer informatie over de Service Fabric PowerShell-module.
Aanvullende PowerShell-voorbeelden voor Azure Service Fabric vindt u in de Azure PowerShell-voorbeelden.