Set-AzServiceFabricManagedClusterApplication

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

Syntax

Set-AzServiceFabricManagedClusterApplication
   [-ResourceGroupName] <String>
   [-ClusterName] <String>
   [-Name] <String>
   [[-ApplicationTypeVersion] <String>]
   [-ApplicationParameter <Hashtable>]
   [-ForceRestart]
   [-RecreateApplication]
   [-UpgradeReplicaSetCheckTimeoutSec <Int32>]
   [-InstanceCloseDelayDurationSec <Int32>]
   [-UpgradeMode <ApplicationUpgradeMode>]
   [-FailureAction <FailureAction>]
   [-HealthCheckRetryTimeoutSec <Int32>]
   [-HealthCheckWaitDurationSec <Int32>]
   [-HealthCheckStableDurationSec <Int32>]
   [-UpgradeDomainTimeoutSec <Int32>]
   [-UpgradeTimeoutSec <Int32>]
   [-ConsiderWarningAsError]
   [-DefaultServiceTypeMaxPercentUnhealthyPartitionsPerService <Int32>]
   [-DefaultServiceTypeMaxPercentUnhealthyReplicasPerPartition <Int32>]
   [-DefaultServiceTypeUnhealthyServicesMaxPercent <Int32>]
   [-UnhealthyDeployedApplicationsMaxPercent <Int32>]
   [-ServiceTypeHealthPolicyMap <Hashtable>]
   [-Tag <Hashtable>]
   [-Force]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzServiceFabricManagedClusterApplication
   [[-ApplicationTypeVersion] <String>]
   [-ApplicationParameter <Hashtable>]
   [-ForceRestart]
   [-RecreateApplication]
   [-UpgradeReplicaSetCheckTimeoutSec <Int32>]
   [-InstanceCloseDelayDurationSec <Int32>]
   [-UpgradeMode <ApplicationUpgradeMode>]
   [-FailureAction <FailureAction>]
   [-HealthCheckRetryTimeoutSec <Int32>]
   [-HealthCheckWaitDurationSec <Int32>]
   [-HealthCheckStableDurationSec <Int32>]
   [-UpgradeDomainTimeoutSec <Int32>]
   [-UpgradeTimeoutSec <Int32>]
   [-ConsiderWarningAsError]
   [-DefaultServiceTypeMaxPercentUnhealthyPartitionsPerService <Int32>]
   [-DefaultServiceTypeMaxPercentUnhealthyReplicasPerPartition <Int32>]
   [-DefaultServiceTypeUnhealthyServicesMaxPercent <Int32>]
   [-UnhealthyDeployedApplicationsMaxPercent <Int32>]
   [-ServiceTypeHealthPolicyMap <Hashtable>]
   [-Tag <Hashtable>]
   -ResourceId <String>
   [-Force]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzServiceFabricManagedClusterApplication
   [[-ApplicationTypeVersion] <String>]
   [-ApplicationParameter <Hashtable>]
   [-ForceRestart]
   [-RecreateApplication]
   [-UpgradeReplicaSetCheckTimeoutSec <Int32>]
   [-InstanceCloseDelayDurationSec <Int32>]
   [-UpgradeMode <ApplicationUpgradeMode>]
   [-FailureAction <FailureAction>]
   [-HealthCheckRetryTimeoutSec <Int32>]
   [-HealthCheckWaitDurationSec <Int32>]
   [-HealthCheckStableDurationSec <Int32>]
   [-UpgradeDomainTimeoutSec <Int32>]
   [-UpgradeTimeoutSec <Int32>]
   [-ConsiderWarningAsError]
   [-DefaultServiceTypeMaxPercentUnhealthyPartitionsPerService <Int32>]
   [-DefaultServiceTypeMaxPercentUnhealthyReplicasPerPartition <Int32>]
   [-DefaultServiceTypeUnhealthyServicesMaxPercent <Int32>]
   [-UnhealthyDeployedApplicationsMaxPercent <Int32>]
   [-ServiceTypeHealthPolicyMap <Hashtable>]
   [-Tag <Hashtable>]
   -InputObject <PSManagedApplication>
   [-Force]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

This cmdlet can be used to update application parameters and upgrade the application type version along with other configuration only updates. 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-AzServiceFabricManagedClusterApplicationTypeVersion.

Examples

Example 1

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

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

Example 2

$resourceGroupName = "testRG"
$clusterName = "testCluster"
$appName = "testApp"
Set-AzServiceFabricManagedClusterApplication -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName -FailureAction Rollback -ForceRestart:$false -Verbose

This example will updates the FailureAction and sets ForceRestart to false.

Example 3

$resourceGroupName = "testRG"
$clusterName = "testCluster"
$appName = "testApp"
$version = "v2"
$packageUrl = "https://sftestapp.blob.core.windows.net/sftestapp/testAppType_v2.sfpkg"
New-AzServiceFabricManagedClusterApplicationTypeVersion -ResourceGroupName $resourceGroupName -ClusterName $clusterName -Name $appName -Version $version -PackageUrl $packageUrl -Verbose
Set-AzServiceFabricManagedClusterApplication -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

Set-AzServiceFabricManagedClusterApplication -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

-AsJob

Run cmdlet in the background and return a Job to track progress.

Type:SwitchParameter
Position:Named
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

-Force

Continue without prompts

Type:SwitchParameter
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 managed application resource.

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

-InstanceCloseDelayDurationSec

Specifies the duration in seconds, to wait before a stateless instance is closed, to allow the active requests to drain gracefully.

Type:Int32
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

-RecreateApplication

Determines whether the application should be recreated on update. If value=true, the rest of the upgrade policy parameters are not allowed.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
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 managed application.

Type:String
Position:Named
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

-Tag

Specify the tags as key/value pairs.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:True
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

-UpgradeMode

The mode used to monitor health during a rolling upgrade. The values are Monitored, and UnmonitoredAuto.

Type:ApplicationUpgradeMode
Accepted values:Monitored, UnmonitoredAuto
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

Hashtable

PSManagedApplication

Outputs

PSManagedApplication