Modifier

Partager via


Invoke-AzStorageSyncChangeDetection

This command can be used to manually initiate the detection of namespace changes. It can be targeted to the entire share, subfolder or set of files. When running the command with the -DirectoryPath or -Path parameters, a maximum of 10,000 items can be detected. If the scope of changes is known to you, limit the execution of this command to parts of the namespace, so change detection can finish quickly and within the 10,000 item limit. Alternatively, you can avoid the item limit by running the cmdlet without these parameters, invoking share-level change detection.

Note

If run with -DirectoryPath or -Path parameters, the command will not detect the following changes in the Azure file share:

  • Files that are deleted.
  • Files that are moved out of the share.
  • Files that are deleted and created with the same name.

If share-level change detection is invoked, all of these changes will be detected. These changes will also be detected when the scheduled change detection job runs.

Syntax

Invoke-AzStorageSyncChangeDetection
      [-ResourceGroupName] <String>
      [-StorageSyncServiceName] <String>
      [-SyncGroupName] <String>
      -Name <String>
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzStorageSyncChangeDetection
      [-ResourceGroupName] <String>
      [-StorageSyncServiceName] <String>
      [-SyncGroupName] <String>
      -Name <String>
      -DirectoryPath <String>
      [-Recursive]
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzStorageSyncChangeDetection
      [-ResourceGroupName] <String>
      [-StorageSyncServiceName] <String>
      [-SyncGroupName] <String>
      -Name <String>
      -Path <String[]>
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzStorageSyncChangeDetection
      [-ResourceId] <String>
      -DirectoryPath <String>
      [-Recursive]
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzStorageSyncChangeDetection
      [-ResourceId] <String>
      -Path <String[]>
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzStorageSyncChangeDetection
      [-ResourceId] <String>
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzStorageSyncChangeDetection
      [-InputObject] <PSCloudEndpoint>
      -DirectoryPath <String>
      [-Recursive]
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzStorageSyncChangeDetection
      [-InputObject] <PSCloudEndpoint>
      -Path <String[]>
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzStorageSyncChangeDetection
      [-InputObject] <PSCloudEndpoint>
      [-PassThru]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Periodically, Azure File Sync checks the namespace inside a syncing Azure file share for changes that came into the file share by other means than sync. The goal is to identify these changes and ultimately sync them to connected servers. This command can be used to manually initiate the detection of namespaces changes. It can be targeted to the entire share, subfolder or set of files. If the scope of changes is known to you, limit the execution of this command to parts of the namespace, so individual item change detection can finish quickly and within the 10,000 items limit. Otherwise, run the command without the -DirectoryPath or -Path parameters to invoke full share-level change detection. The Invoke-AzStorageSyncChangeDetection cmdlet will cancel a cloud change enumeration job that is in progress. To avoid cancelling a currently running job, go to the Cloud Endpoint properties in the portal to check if a job is currently running.

Examples

Example 1

Invoke-AzStorageSyncChangeDetection -ResourceGroupName "myResourceGroup" -StorageSyncServiceName "myStorageSyncServiceName" -SyncGroupName "mySyncGroupName" -CloudEndpointName "b38fc242-8100-4807-89d0-399cef5863bf" -Path "Data","Reporting\Templates"

In this example, change detection is run in the "Data" and "Reporting\Templates" directories of a syncing Azure file share. All paths are relative to the root of the Azure file share namespace.

Example 2

Invoke-AzStorageSyncChangeDetection -ResourceGroupName "myResourceGroup" -StorageSyncServiceName "myStorageSyncServiceName" -SyncGroupName "mySyncGroupName" -CloudEndpointName "b38fc242-8100-4807-89d0-399cef5863bf" -Path "Data\results.xslx","Reporting\Templates\generated.pptx"

In this example, change detection is run for a set of files that are known to the command caller to have changed. The goal is to have Azure file sync detect and sync these changes as well.

Example 3

Invoke-AzStorageSyncChangeDetection -ResourceGroupName "myResourceGroup" -StorageSyncServiceName "myStorageSyncServiceName" -SyncGroupName "mySyncGroupName" -CloudEndpointName "b38fc242-8100-4807-89d0-399cef5863bf" -DirectoryPath "Examples" -Recursive

In this example, change detection is run for the "Examples" directory and will recursively detect changes in subdirectories. Keep in mind the cmdlet will fail if the path contains more than 10,000 items. If the path contains more than 10,000 items, run the command on sub-parts of the namespace.

Example 4

Invoke-AzStorageSyncChangeDetection -ResourceGroupName "myResourceGroup" -StorageSyncServiceName "myStorageSyncServiceName" -SyncGroupName "mySyncGroupName" -CloudEndpointName "b38fc242-8100-4807-89d0-399cef5863bf"

In this example, neither -DirectoryPath nor -Path has been passed to the command. This will invoke change detection on the entire file share.

Parameters

-AsJob

Run cmdlet in the background

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

-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

-DirectoryPath

Directory where change detection will be performed.

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

-InputObject

CloudEndpoint Object, normally passed through the parameter.

Type:PSCloudEndpoint
Aliases:CloudEndpoint
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Name of the CloudEndpoint. The name is a GUID, not the friendly name that's displayed in the portal. To get the CloudEndpointName, use the Get-AzStorageSyncCloudEndpoint cmdlet.

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

-PassThru

In normal execution, this cmdlet returns no value on success. If you provide the PassThru parameter, then the cmdlet will write a value to the pipeline after successful execution.

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

-Path

Path where change detection will be performed.

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

-Recursive

Indication whether directory change detection is recursive.

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

-ResourceGroupName

Resource Group Name.

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

-ResourceId

CloudEndpoint Resource Id

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

-StorageSyncServiceName

Name of the StorageSyncService.

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

-SyncGroupName

Name of the SyncGroup.

Type:String
Position:2
Default value:None
Required:True
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

PSServerEndpoint

Outputs

Void