Update-ServiceFabricService

Updates a Service Fabric service.

Syntax

Update-ServiceFabricService
      [-Stateless]
      [-ServiceName] <Uri>
      [-InstanceCount <Int32>]
      [-MinInstanceCount <Int32>]
      [-MinInstancePercentage <Int32>]
      [-InstanceLifecycleDescription <InstanceLifecycleDescription>]
      [-Force]
      [-PlacementConstraints <String>]
      [-Metric <String[]>]
      [-Correlation <String[]>]
      [-PlacementPolicy <String[]>]
      [-DefaultMoveCost <String>]
      [-PartitionNamesToAdd <String[]>]
      [-PartitionNamesToRemove <String[]>]
      [-ScalingPolicies <System.Collections.Generic.List`1[System.Fabric.Description.ScalingPolicyDescription]>]
      [-InstanceCloseDelayDuration <TimeSpan>]
      [-InstanceRestartWaitDuration <TimeSpan>]
      [-ServiceDnsName <String>]
      [-TagsRequiredToPlace <System.Collections.Generic.List`1[System.String]>]
      [-TagsRequiredToRun <System.Collections.Generic.List`1[System.String]>]
      [-TimeoutSec <Int32>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-ServiceFabricService
      [-Stateful]
      [-ServiceName] <Uri>
      [-TargetReplicaSetSize <Int32>]
      [-MinReplicaSetSize <Int32>]
      [-ReplicaRestartWaitDuration <TimeSpan>]
      [-QuorumLossWaitDuration <TimeSpan>]
      [-StandByReplicaKeepDuration <TimeSpan>]
      [-ServicePlacementTimeLimit <TimeSpan>]
      [-DropSourceReplicaOnMove <Boolean>]
      [-ReplicaLifecycleDescription <ReplicaLifecycleDescription>]
      [-Force]
      [-PlacementConstraints <String>]
      [-Metric <String[]>]
      [-Correlation <String[]>]
      [-PlacementPolicy <String[]>]
      [-DefaultMoveCost <String>]
      [-PartitionNamesToAdd <String[]>]
      [-PartitionNamesToRemove <String[]>]
      [-ScalingPolicies <System.Collections.Generic.List`1[System.Fabric.Description.ScalingPolicyDescription]>]
      [-ServiceDnsName <String>]
      [-TagsRequiredToPlace <System.Collections.Generic.List`1[System.String]>]
      [-TagsRequiredToRun <System.Collections.Generic.List`1[System.String]>]
      [-TimeoutSec <Int32>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Update-ServiceFabricService cmdlet updates properties of a running Service Fabric service. The set of properties that can be updated are a subset of the properties that were specified at the time of creating the service (using New-ServiceFabricService or New-ServiceFabricServiceFromTemplate). You can get current properties of your service using Get-ServiceFabricServiceDescription.

Please note that updating the properties of a running service is different than upgrading your service using Start-ServiceFabricApplicationUpgrade.Upgrading your service (i.e. application) is a long running background task that involves moving your application, from one version to another, one upgrade domain at a time. Please see Service Fabric Application Upgrade (https://docs.microsoft.com/azure/service-fabric/service-fabric-application-upgrade) for more details.

Before you perform any operation on a Service Fabric cluster, establish a connection to the cluster by using the Connect-ServiceFabricCluster cmdlet.

Examples

Example 1: Update a stateful service

PS C:\> Update-ServiceFabricService -Stateful fabric:/myapp/test -MinReplicaSetSize 3 -TargetReplicaSetSize 5

This command updates the MinReplicaSetSize and TargetReplicaSetSize of a running Fabric Service to three (3) and five (5).

Example 2: Update a stateless service

PS C:\> Update-ServiceFabricService -Stateless fabric:/myapp/test -InstanceCount -1

This command updates the instance count of a running Fabric Service to a value of -1.

Example 3: Update placement constraints

PS C:\> Update-ServiceabricService -Stateless -ServiceName fabric:/myapp/test -PlacementConstraints "NodeName!=NodeBar"

This command updates the placement constraints.

Example 4: Update default load metrics

PS C:\> Update-ServiceFabricService -Stateless -ServiceName fabric:/myapp/test -Metric @("CPU,High,10")
PS C:\> Update-ServiceFabricService -Stateful -ServiceName fabric:/myapp/test -Metric @("CPU,High,10,1")

The first command updates the default load metrics for a stateless service.

The second command updates the default load metrics for a stateful service.

Example 5: Update placement policy

PS C:\> Update-ServiceFabricService -Stateful -ServiceName fabric:/myapp/test -PlacementPolicy @("InvalidDomain,fd:/dc2/rack2")

This command updates the placement policy.

Example 6: Update service correlation

PS C:\> Update-ServiceFabricService -Stateful -ServiceName fabric:/myapp/test -Correlation @("fabric:/app/test2,AlignedAffinity")

This command updates the service correlation.

Example 7: Update service DNS name

PS C:\> Update-ServiceFabricService -Stateful -ServiceName fabric:/myapp/test -ServiceDnsName stateful.dns
PS C:\> Update-ServiceFabricService -Stateless -ServiceName fabric:/myapp/test -ServiceDnsName stateless.dns

This command updates the service DNS name of a service. Note : If the updated DNS name has already been queried on the cluster or the updating service already had a DNS name, DNS service should be restarted after the update to invalidate the cache.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Correlation

Specifies an updated array of correlation constraints for this service. To learn more about service correlation, see Configuring and using service affinity in Service Fabric (https://docs.microsoft.com/azure/service-fabric/service-fabric-cluster-resource-manager-advanced-placement-rules-affinity).

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultMoveCost

Specifies the updated default move cost that replicas have when they are created. The acceptable values for this parameter are:

  • Zero
  • Low
  • Medium
  • High

For more details about move cost, see Service movement cost for influencing Cluster Resource Manager choices (https://docs.microsoft.com/azure/service-fabric/service-fabric-cluster-resource-manager-movement-cost).

Type:String
Accepted values:Zero, Low, Medium, High, VeryHigh
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DropSourceReplicaOnMove

Enables source Secondary replicas to be dropped before new Secondary replicas finish the build.

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

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

Specifies the duration in seconds, to wait before a stateless instance which is impacted by application upgrade is closed, to allow the active requests to drain gracefully. This wait duration is effective only for the instances of those stateless services which have a non-zero value configured for the InstanceCloseDelayDuration, and will override the pre-configured value. See InstanceCloseDelayDuration for details. Do not specify this parameter for stateful services.

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InstanceCount

Specifies the updated number of instances for the Service Fabric stateless service. Do not specify this parameter for stateful services.

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

Lifecycle description of instances belonging to this service. If some configuration in this section is not specified, the default value is taken from the cluster parameter of the same name (if existing).

Type:InstanceLifecycleDescription
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InstanceRestartWaitDuration

When a stateless instance goes down, this timer starts. When it expires Service Fabric will create a new instance on any node in the cluster. This configuration is to reduce unnecessary creation of a new instance in situations where the instance going down is likely to recover in a short time. For example, during an upgrade. The default value is 0, which indicates that when stateless instance goes down, Service Fabric will immediately start building its replacement.

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Metric

Specifies the updated array of metrics that the service reports. To learn more about metrics, see Managing resource consumption and load in Service Fabric with metrics (https://docs.microsoft.com/azure/service-fabric/service-fabric-cluster-resource-manager-metrics).

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MinInstanceCount

Specifies the updated minimum number of instances of the stateless service partition. See MinInstanceCount (in New-ServiceFabricService) for details. Do not specify this parameter for stateful services.

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

Specifies the updated minimum percentage of InstanceCount of a stateless service partition. See MinInstancePercentage (in New-ServiceFabricService) for details. Do not specify this parameter for stateful services.

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

Specifies the updated minimum replica set size for the Service Fabric stateful service. The value must be less than the TargetReplicaSetSize of this service. For more details, see StatefulServiceDescription.MinReplicaSetSize (https://docs.microsoft.com/dotnet/api/system.fabric.description.statefulservicedescription#System_Fabric_Description_StatefulServiceDescription_MinReplicaSetSize).

Do not specify this parameter for stateless services.

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

{{Fill PartitionNamesToAdd Description}}

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PartitionNamesToRemove

{{Fill PartitionNamesToRemove Description}}

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PlacementConstraints

Specifies the updated placement constraint for the service. To learn more about placement constraints, see Placement constraints and node properties (https://docs.microsoft.com/azure/service-fabric/service-fabric-cluster-resource-manager-cluster-description#placement-constraints-and-node-properties).

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PlacementPolicy

Specifies an updated array of placement policies for a service. To learn more about PlacementPolicy, see Placement policies for service fabric services (https://docs.microsoft.com/azure/service-fabric/service-fabric-cluster-resource-manager-advanced-placement-rules-placement-policies).

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-QuorumLossWaitDuration

Specifies the updated duration, as a TimeSpan object, that Service Fabric waits before it declares data loss for a service partition.

To obtain a TimeSpan object, use the New-TimeSpan cmdlet. For more information, type Get-Help New-TimeSpan.

To learn more about the QuorumLossWaitDuration parameter, see StatefulServiceDescription.QuorumLossWaitDuration (https://docs.microsoft.com/dotnet/api/system.fabric.description.statefulservicedescription#System_Fabric_Description_StatefulServiceDescription_QuorumLossWaitDuration).

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ReplicaLifecycleDescription

Lifecycle description of replicas belonging to this service. If some configuration in this section is not specified, the default value is taken from the cluster parameter of the same name (if existing).

Type:ReplicaLifecycleDescription
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ReplicaRestartWaitDuration

Specifies the updated interval, as a TimeSpan object, that Service Fabric waits for the replica to restart before it creates a replacement replica. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.

To learn more about QuorumLossWaitDuration, see StatefulServiceDescription.ReplicaRestartWaitDuration (https://docs.microsoft.com/dotnet/api/system.fabric.description.statefulservicedescription#System_Fabric_Description_StatefulServiceDescription_ReplicaRestartWaitDuration).

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ScalingPolicies

{{Fill ScalingPolicies Description}}

Type:System.Collections.Generic.List`1[System.Fabric.Description.ScalingPolicyDescription]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServiceDnsName

Specifies the updated DNS name of a service.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServiceName

Specifies the URI of a Service Fabric service whose properties need to be updated.

Type:Uri
Position:1
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ServicePlacementTimeLimit

Sets the service placement time limit.

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StandByReplicaKeepDuration

Specifies the updated stand-by replica keep duration as a TimeSpan object.

To learn more about QuorumLossWaitDuration, see StatefulServiceDescription.StandByReplicaKeepDuration (https://docs.microsoft.com/dotnet/api/system.fabric.description.statefulservicedescription#System_Fabric_Description_StatefulServiceDescription_StandByReplicaKeepDuration).

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Stateful

Indicates that the service is a Service Fabric stateful service.

Type:SwitchParameter
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Stateless

Indicates that the service is a Service Fabric stateless service.

Type:SwitchParameter
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TagsRequiredToPlace

Declares tags required for placement of a service. Useful for dynamically influencing service placement. For more, see Service Fabric Dynamic Node Tags

Type:System.Collections.Generic.List`1[System.String]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TagsRequiredToRun

Declares tags required for placement and running of a service. Useful for dynamically influencing service placement and running. For more, see Service Fabric Dynamic Node Tags

Type:System.Collections.Generic.List`1[System.String]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TargetReplicaSetSize

Specifies the updated target replica set size for a Service Fabric stateful service. For more details, see StatefulServiceDescription.TargetReplicaSetSize (https://docs.microsoft.com/dotnet/api/system.fabric.description.statefulservicedescription#System_Fabric_Description_StatefulServiceDescription_TargetReplicaSetSize).

Do not specify this parameter for a stateless service.

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

Specifies the time-out period, in seconds, for the operation.

Type:Int32
Position:Named
Default value:None
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:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.Uri

Outputs

System.Object