How can I copy files from Azure Blob Storage to user computers using PowerShell?
Asked by
_skip the introduction
I've recently transitioned to using Azure Entra and completely moved away from file servers. Now, I'm looking for the best way to utilize Azure Blob Storage as a file repository that I can access and copy files to users' computers with PowerShell. This is intended to replace our traditional logon scripts. Sometimes these are single files, and other times they are entire folders.
I'm exploring options like AzCopy but I'd prefer not to keep a drive mapped for users all the time. I'm also considering enabling SMB on Blob Storage and using Robocopy through a network share that points to it. Any suggestions or best practices would be appreciated!
Answers
Youโve got a few options here! You can use the REST API, PowerShell cmdlets, or AzCopy to manage file transfers. Iโd recommend checking how to manage storage accounts first so you have a solid foundation before diving into any unfamiliar tech.
Reply to this answer
It's a bit unclear what you're trying to accomplish, but if you need something to run at every login, a scheduled task could be the way to go. You can deploy a Win32 app that sets up a task to run your PowerShell script each time a user logs in. Just keep in mind, you can't enable SMB on Blob Storageโthat's specifically for Azure File Shares.
Reply to this answer
I think using Intune with AzCopy might be more flexible for you. Considering the frequent changes to your files, a scheduled task might make the most sense. Just ensure AzCopy is included in the setup process to pull the necessary files during execution.
Reply to this answer
AzCopy can definitely work without needing to map a drive. We use it as well and just trigger it with a scheduled task using a SAS token for secure access.
Reply to this answer
Using the Az.Storage PowerShell module is a solid choice. Make sure itโs installed on the users' devices so the scripts can run without issues. Itโs great for handling Azure storage directly.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions