Home
> Uncategorized > Access #Azure #CLI from SQL server
Access #Azure #CLI from SQL server
If you want to automate Azure tasks directly from a scheduled job in SQL server, such as transferring a database backup to Azure blob storage once a backup is complete, then you may run into this issue;
You run a simple command like
xp_cmdshell ‘az storage account list’
And you get an error message
ERROR: Please run ‘az login’ to setup account.
but that doesnt work, since it’ll try to open a web browser.
So, the trick is, assuming you’ve logged in under your user account correctly, copy the “.azure” folder (it’s hidden), and move it to the windows user profile used by SQL server.
Want to know what that is?, just run;
xp_cmdshell ‘echo %userprofile%’
Once you’ve copied the .azure folder, then the commands will run as normal
Categories: Uncategorized
Comments (0)
Trackbacks (0)
Leave a comment
Trackback