編輯

共用方式為


Update-AzServiceFabricApplication

Update a service fabric application. This allows to update the application parameters and/or upgrade the application type version which will trigger an application upgrade. Only supports ARM deployed applications.

Syntax

Update-AzServiceFabricApplication
      [-ResourceGroupName] <String>
      [-ClusterName] <String>
      [-Name] <String>
      [[-ApplicationTypeVersion] <String>]
      [-ApplicationParameter <Hashtable>]
      [-MinimumNodeCount <Int64>]
      [-MaximumNodeCount <Int64>]
      [-ForceRestart]
      [-UpgradeReplicaSetCheckTimeoutSec <Int32>]
      [-FailureAction <FailureAction>]
      [-HealthCheckRetryTimeoutSec <Int32>]
      [-HealthCheckWaitDurationSec <Int32>]
      [-HealthCheckStableDurationSec <Int32>]
      [-UpgradeDomainTimeoutSec <Int32>]
      [-UpgradeTimeoutSec <Int32>]
      [-ConsiderWarningAsError]
      [-DefaultServiceTypeMaxPercentUnhealthyPartitionsPerService <Int32>]
      [-DefaultServiceTypeMaxPercentUnhealthyReplicasPerPartition <Int32>]
      [-DefaultServiceTypeUnhealthyServicesMaxPercent <Int32>]
      [-UnhealthyDeployedApplicationsMaxPercent <Int32>]
      [-ServiceTypeHealthPolicyMap <Hashtable>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzServiceFabricApplication
      [[-ApplicationTypeVersion] <String>]
      [-ApplicationParameter <Hashtable>]
      [-MinimumNodeCount <Int64>]
      [-MaximumNodeCount <Int64>]
      [-ForceRestart]
      [-UpgradeReplicaSetCheckTimeoutSec <Int32>]
      [-FailureAction <FailureAction>]
      [-HealthCheckRetryTimeoutSec <Int32>]
      [-HealthCheckWaitDurationSec <Int32>]
      [-HealthCheckStableDurationSec <Int32>]
      [-UpgradeDomainTimeoutSec <Int32>]
      [-UpgradeTimeoutSec <Int32>]
      [-ConsiderWarningAsError]
      [-DefaultServiceTypeMaxPercentUnhealthyPartitionsPerService <Int32>]
      [-DefaultServiceTypeMaxPercentUnhealthyReplicasPerPartition <Int32>]
      [-DefaultServiceTypeUnhealthyServicesMaxPercent <Int32>]
      [-UnhealthyDeployedApplicationsMaxPercent <Int32>]
      [-ServiceTypeHealthPolicyMap <Hashtable>]
      [-ResourceId] <String>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzServiceFabricApplication
      -InputObject <PSApplication>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

This cmdlet can be used to update application parameters and upgrade the application type version. Updating the parameter will only change the model in ARM side, only when a new type version is used, the command will trigger an application upgrade. The type version specified should already be created in the cluster using New-AzServiceFabricApplicationTypeVersion.

Examples

Example 1

$resourceGroupName = "testRG"
$clusterName = "testCluster"
$appName = "testApp"
$version = "v2"
$packageUrl = "https://sftestapp.blob.core.windows.net/sftestapp/testAppType_v2.sfpkg"
New-AzServiceFabricApplicationTypeVersion -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName -Version $version -PackageUrl $packageUrl -Verbose
Update-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationTypeVersion $version -Name $appName -ApplicationParameter @{key0="value0";key1=$null;key2="value2"}

This example will start an application upgrade to update the type version to "v2" which was created with New-AzServiceFabricApplicationTypeVersion. The application parameters used should be defined in the application manifest.

Example 2

$resourceGroupName = "testRG"
$clusterName = "testCluster"
$appName = "testApp"
Update-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName -MinimumNodeCount 1 -MaximumNodeCount 4 -Verbose

This example will update the minimum and maximum number of nodes restriction for the application.

Example 3

$resourceGroupName = "testRG"
$clusterName = "testCluster"
$appName = "testApp"
$version = "v2"
$packageUrl = "https://sftestapp.blob.core.windows.net/sftestapp/testAppType_v2.sfpkg"
New-AzServiceFabricApplicationTypeVersion -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName -Version $version -PackageUrl $packageUrl -Verbose
Update-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -ApplicationTypeVersion $version -Name $appName -ApplicationParameter @{key0="value0";key1=$null;key2="value2"} -HealthCheckStableDurationSec 0 -HealthCheckWaitDurationSec 0 -HealthCheckRetryTimeoutSec 0 -UpgradeDomainTimeoutSec 5000 -UpgradeTimeoutSec 7000 -FailureAction Rollback -UpgradeReplicaSetCheckTimeoutSec 300 -ForceRestart

This example will start an application upgrade to update the type version to "v2" and also sets some upgrade policy parameters that will take effect from the current upgrade.

Example 4

Update-AzServiceFabricApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName -ApplicationParameter @{key0="value0";key1=$null;key2="value2"}

This example updates the application parameters but these changes will only take effect until the next version upgrade to the application.

Parameters

-ApplicationParameter

Specify the application parameters as key/value pairs. These parameters must exist in the application manifest.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ApplicationTypeVersion

Specify the application type version

Type:String
Position:3
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ClusterName

Specify the name of the cluster.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ConsiderWarningAsError

Indicates whether to treat a warning health event as an error event during health evaluation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultServiceTypeMaxPercentUnhealthyPartitionsPerService

Specifies the maximum percent of unhelthy partitions per service allowed by the health policy for the default service type to use for the monitored upgrade.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultServiceTypeMaxPercentUnhealthyReplicasPerPartition

Specifies the maximum percent of unhelthy replicas per service allowed by the health policy for the default service type to use for the monitored upgrade.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultServiceTypeUnhealthyServicesMaxPercent

Specifies the maximum percent of unhelthy services allowed by the health policy for the default service type to use for the monitored upgrade.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FailureAction

Specifies the action to take if the monitored upgrade fails. The acceptable values for this parameter are Rollback or Manual.

Type:FailureAction
Accepted values:Rollback, Manual
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ForceRestart

Indicates that the service host restarts even if the upgrade is a configuration-only change.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HealthCheckRetryTimeoutSec

Specifies the duration, in seconds, after which Service Fabric retries the health check if the previous health check fails.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HealthCheckStableDurationSec

Specifies the duration, in seconds, that Service Fabric waits in order to verify that the application is stable before moving to the next upgrade domain or completing the upgrade. This wait duration prevents undetected changes of health right after the health check is performed.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HealthCheckWaitDurationSec

Specifies the duration, in seconds, that Service Fabric waits before it performs the initial health check after it finishes the upgrade on the upgrade domain.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

The application resource.

Type:PSApplication
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-MaximumNodeCount

Specifies the maximum number of nodes on which to place an application

Type:Int64
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MinimumNodeCount

Specifies the minimum number of nodes where Service Fabric will reserve capacity for this application

Type:Int64
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specify the name of the application

Type:String
Aliases:ApplicationName
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

Specify the name of the resource group.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ResourceId

Arm ResourceId of the application.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ServiceTypeHealthPolicyMap

Specifies the map of the health policy to use for different service types as a hash table in the following format: @ {"ServiceTypeName" : "MaxPercentUnhealthyPartitionsPerService,MaxPercentUnhealthyReplicasPerPartition,MaxPercentUnhealthyServices"}. For example: @{ "ServiceTypeName01" = "5,10,5"; "ServiceTypeName02" = "5,5,5" }

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UnhealthyDeployedApplicationsMaxPercent

Specifies the maximum percentage of the application instances deployed on the nodes in the cluster that have a health state of error before the application health state for the cluster is error.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UpgradeDomainTimeoutSec

Specifies the maximum time, in seconds, that Service Fabric takes to upgrade a single upgrade domain. After this period, the upgrade fails.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UpgradeReplicaSetCheckTimeoutSec

Specifies the maximum time that Service Fabric waits for a service to reconfigure into a safe state, if not already in a safe state, before Service Fabric proceeds with the upgrade.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UpgradeTimeoutSec

Specifies the maximum time, in seconds, that Service Fabric takes for the entire upgrade. After this period, the upgrade fails.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

PSApplication

Outputs

PSApplication