Edit

Set-AzStorageSyncServer

This command will set the server with identity. This helps to enable the server with identity features.

Syntax

StringParameterSet (Default)

Set-AzStorageSyncServer
    [-ResourceGroupName] <String>
    [-StorageSyncServiceName] <String>
    [[-ServerId] <String>]
    [-Identity]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ObjectParameterSet

Set-AzStorageSyncServer
    [-InputObject] <PSRegisteredServer>
    [-Identity]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

This command patches a server's managed identity. This command will update the server managed identity used to describe the server identity to the storage sync service. This is meant to be used in troubleshooting scenarios, or when the managed identity has been externally updated and Azure File Sync needs to be updated to reflect these changes. When calling this command, the server's applicationId is replaced with the new one provided, re-establishing the trust relationship between this server and its storage sync service.

This cmdlet is used to repair a server where the server to service relationship established using a managed identity has been broken. This issue typically results in authentication errors and often occurs when the server's managed identity has changed, such as when Azure Arc was deleted and recreated or when the managed identity on an Azure VM was toggled off and back on.

The command must be run locally on the server that is to be patched - either executed directly or via a remote PowerShell session. A remote computer object cannot be accepted. When using the Identity parameter, run the command from an elevated PowerShell session. On an Azure Arc-enabled server, the local identity endpoint only issues tokens to local Administrators or members of the Hybrid agent extension applications group.

Examples

Example 1

Set-AzStorageSyncServer -ResourceGroupName "myResourceGroup" -StorageSyncServiceName "myStorageSyncServiceName" -ServerId "<guid>" -Identity

This command configures the specified registered server to use its system-assigned managed identity. Run the command locally from an elevated PowerShell session on that registered server.

Parameters

-AsJob

Run cmdlet in the background

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Identity

Registered Server Identity

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

RegisteredServer Object, normally passed through the parameter.

Parameter properties

Type:PSRegisteredServer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:RegisteredServer

Parameter sets

ObjectParameterSet
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

Resource Group Name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

StringParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ServerId

ID of the registered server. If omitted, the cmdlet uses the server ID reported by the Azure File Sync agent on the local machine.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:RegisteredServerName

Parameter sets

StringParameterSet
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StorageSyncServiceName

Name of the StorageSyncService.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ParentName

Parameter sets

StringParameterSet
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

PSStorageSyncService

Outputs

PSRegisteredServer