Migrate FSLogix Profiles to a new Storage Account

If you need to migrate FSLogix profiles to a new storage account, Microsoft makes this very easy using the azcopy tool. You can also use Robocopy like we did back in the days of file server migrations, but azcopy is significantly faster. If you encounter an AVD environment that is using a transaction-optimized storage account file share, you should move to AZ Files Premium as soon as possible. I encountered several clients recently who were using transaction-optimized storage, and the performance differences between TO and AZ Files Premium are very noticeable. Also, in most cases, AZ Files premium will cost less since you’re not paying transaction fees.

Azure Files storage accounts are pretty simple. It’s essentially a PaaS file storage offering and the recommended storage method for FSLogix Profiles. FSLogix profiles are permission sensitive. It’s essential that permissions are properly configured before sign-ins occur, and it’s equally important that the correct permissions are moved to the new storage account location. Here is more information from Microsoft on the recommended permissions for FSLogix – Configure SMB Storage Permissions – FSLogix | Microsoft Learn.

We will assume if you’re reading this you already have a storage account with FSLogix profiles, and you know how to create a new premium Azure files storage account. Once you have your new storage account configured, you’re ready to perform your copy. You’ll need a maintenance window for this where you put your hosts in drain mode and force sign-out all users since you don’t want user profiles mounted at the time of the migration. Also, the storage account network settings will need to allow connections from the machine where you’re running the AZ Copy job. A safe bet is to use a session host for this since it should have access to both storage accounts.

You’ll need to download AZ Copy. You can learn more about AZ copy and download it from this link – Copy or move data to Azure Storage by using AzCopy v10 | Microsoft Learn. Extract the contents to a location on the computer where you’ll be running the copy job.

Next, we need to generate a Shared Access Signature for our source and destination storage accounts. Select each storage account, and under Security + Networking, select Shared access signature. Add an expiration date for the SAS, select the proper permissions for the file services, and configure an allowed IP address if you’d like. Leaving that field blank will allow it to be used from Any IP. Click the generate SAS and connection string button, and copy the SAS Token:

You should have two SAS tokens saved – one for our source, where the FSLogix profiles currently live, and another for the destination where we want to copy them.

Now we can create our azcopy command that will copy the profiles to the new account. The options we use are important. Using these options, all subfolders and files will be copied, permissions will be retained, and all file info will also be retained. A list of additional az copy options can be found here – azcopy copy | Microsoft Learn. This is what our script template looks like:

azcopy copy "<SOURCE SA URL/FOLDER><SAS KEY>" "<DESTINATION SA URL><SAS KEY>" –recursive –preserve-permissions=true –preserve-smb-info=true

This ends uppretty messy after you put it together since SAS tokens are long random strings. Here is an example of how it will look. If you are copying the entire FSLogix share, we simply specify the destination storage account and the SAS token, and the top-level share will be created:

azcopy.exe copy "https://sourcesa.file.core.windows.net/fslogixprofiles?sv=2022-11-02&ss=asdfasdf=asdfasdf=asfdsa=2023-11-7T22:15:32Z&st=2023-11-8T14:15:32Z&spr=https&sig=asdfdsajkshdjfhajo0bIe9I4UwuJvSa65asdcferwE1s%3D" "https://destinationsa.file.core.windows.net/?sv=2022-11-02&ss=f&srt=asdfas=asdasdf=2023-11-7T22:14:57Z&st=2023-11-8T14:14:57Z&spr=https&sig=asdlkjcfkvdlalksjdiNSasdfcrMO27cs%2FY%3D" --recursive --preserve-permissions=true --preserve-smb-info=true

In the event you only wanted to copy a single directory or profile, the syntax would look like this, where we do down one level of directory for source and destination:

azcopy.exe copy "https://sourcesa.file.core.windows.net/fslogixprofiles/gnovak_S-1-5-21-1234556802-123456784-3123456773-11234?sv=2022-11-02&ss=asdfasdf=asdfasdf=asfdsa=2023-11-7T22:15:32Z&st=2023-11-8T14:15:32Z&spr=https&sig=asdfdsajkshdjfhajo0bIe9I4UwuJvSa65oasvcrwaf%3D" "https://destinationsa.file.core.windows.net/fslogixprofiles/?sv=2022-11-02&ss=f&srt=asdfas=asdasdf=2023-11-7T22:14:57Z&st=2023-11-8T14:14:57Z&spr=https&sig=asdlkjcfkvdlalksjdiNSjo5W319iCSMasdcerwa3D" --recursive --preserve-permissions=true --preserve-smb-info=true

A log will be generated and stored in c:\users\username\.azcopy\nameoflog.log. Here is a quick example of copying one profile to a new storage account. You can see AZ copy uses numerous consurrent connections between the two storage accounts resulting in much faster copy speeds.

After your profiles are copied, don’t forget to update your GPOs or Device Configuration profiles to point to the new FSLogix location and take your hosts out of drain mode.