Below script is used to migrate the user profiles between two different storage accounts in a single region.

# This script created to move FSlogix user profiles from one storage account to another in same region.
# In CSV input file, userlogon name is taken . Script searches with logon name in storage and move to Destination storage

Set-Location "C:\Migration" #set the path where azopy exists 

#Provide the input file with Logon Names

$Lists = Import-csv -Path "C:\Migration\profile4input.csv" 

$source = "//<storageaccountname>.file.core.windows.net/<Share Name>"
$sourceSas = "<SAS Key>"


$destination = "//<storageaccountname>.file.core.windows.net/<Share Name>"
$destinationSas = "<SAS Key>"
$items = Get-ChildItem -Path $source

$report = @()
foreach($item in $items){
    
    $itemName = $item.Name
    foreach($list in $lists){
        
        $UserName = $list.Users
        if($itemName -cmatch $UserName){
        
            #azcopy
           $SourceFullPath = "https:$source/$itemName$sourceSas"
           $destinationFullPath = "https:$destination$destinationSas"
           $output = ./azcopy.exe copy $SourceFullPath $destinationFullPath --overwrite=true --preserve-smb-permissions=true --preserve-smb-info=false --recursive --trusted-microsoft-suffixes= --log-level=INFO;
           
           $output

           $No_Of_files_Transferred = $output[-9].split(":")[-1]         
           $No_of_Folder_Property_Transfers = $output[-8].split(":")[-1]
           $Total_No_of_Transfers = $output[-7].split(":")[-1]
           $No_of_Transfers_Completed = $output[-6].split(":")[-1]
           $No_of_Transfers_Failed = $output[-5].split(":")[-1]
           $No_of_Transfers_Skipped = $output[-4].split(":")[-1]
           $TotalBytesTransferred = $output[-3].split(":")[-1]
           $Final_Job_Status = $output[-2].split(":")[-1]
           $report += @{
                UserId = $UserName;
                No_Of_files_Transferred = $No_Of_files_Transferred;
                No_of_Folder_Property_Transfers = $No_of_Folder_Property_Transfers;
                Total_No_of_Transfers = $Total_No_of_Transfers;
                No_of_Transfers_Completed = $No_of_Transfers_Completed;
                No_of_Transfers_Failed = $No_of_Transfers_Failed;
                No_of_Transfers_Skipped = $No_of_Transfers_Skipped;
                TotalBytesTransferred = $TotalBytesTransferred;
                Final_Job_Status = $Final_Job_Status
  
                    }
                   
        }

    }
}
$json = @{Profile = $report}| ConvertTo-Json
($JSONData = $json | ConvertFrom-Json)
$JSONData.profile | Export-Csv -Path "C:\Migration\profile4outputlog_16aug21.csv" -Append -NoTypeInformation