Skip to content

Instantly share code, notes, and snippets.

@transiient
Created April 13, 2023 10:40
Show Gist options
  • Save transiient/2a4d87bdbf08d0fe1b4c4a02b4ae82a5 to your computer and use it in GitHub Desktop.
Save transiient/2a4d87bdbf08d0fe1b4c4a02b4ae82a5 to your computer and use it in GitHub Desktop.
Export Azure File Sync drive mappings from Azure to a CSV file
$RSG_Name = Read-Host "Enter the name of the Resource Group in which the Sync Service resides:"
$SyncService_Name = Read-Host "Enter the name of the Sync Service:"
$ExportPath = Read-Host "Enter the path and filename (ending with .csv) to export to:"
$StorageSyncGroups = Get-AzStorageSyncGroup -ResourceGroupName $RSG_Name -StorageSyncServiceName $SyncService_Name
$Objects = foreach ($_SSG in $StorageSyncGroups) {
$_SSE = Get-AzStorageSyncServerEndpoint -ResourceGroupName $RSG_Name -StorageSyncServiceName $SyncService_Name -SyncGroupName $_SSG.SyncGroupName
New-Object -TypeName PSObject -Property @{
SyncGroupName = $_SSG.SyncGroupName
SyncServerName = $_SSE.FriendlyName
SyncServerLocalPath = $_SSE.ServerLocalPath
CloudTiering = $_SSE.CloudTiering
} | Select-Object SyncGroupName,SyncServerName,SyncServerLocalPath,CloudTiering
}
$Objects | Export-Csv -NoTypeInformation -NoClobber "${ExportPath}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment