You can use the AZCopy tool for it
https://learn.microsoft.com/en-us/azure/storage/common/storage-ref-azcopy
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Does anyone has any idea if windows batch job can access to azure blob storage to grab a file using MS DOS script?
You can use the AZCopy tool for it
https://learn.microsoft.com/en-us/azure/storage/common/storage-ref-azcopy
@Loke Welcome to Microsoft Q&A Forum, Thank you for posting your query here!
To connect to Blob storage via a Windows batch job, you can use the Azure CLI (Command-Line Interface) or AzCopy utility. These tools allow you to interact with Azure Blob storage from the command line. Here's a step-by-step guide on how to do it using the Azure CLI:
azlogin
az account set --subscription <subscription_id_or_name>
az storage blob list --account-name <storage_account_name> --account-key <sas_token> --container-name <container_name>
Adding more information to @Olaf Helper response!
Windows batch job can access Azure Blob storage and grab a file using MS-DOS script (batch script). You can achieve this by using the Azure AzCopy utility, which is a command-line tool designed to copy data to and from Azure Blob storage.
Here is an example Windows batch script that uses azcopy
to download a file from Azure Blob Storage:
@echo off
setlocal
set storage_account_name=<your_storage_account_name>
set container_name=<your_container_name>
set blob_name=<your_blob_name>
set destination_path=<your_destination_path>
set source_url=https://%storage_account_name%.blob.core.windows.net/%container_name%/%blob_name%
azcopy copy "%source_url%" "%destination_path%" --recursive
if %errorlevel% equ 0 (
echo File downloaded successfully.
) else (
echo Error downloading file.
)
endlocal
Please let us know if you have any further queries. I’m happy to assist you further.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.