September 11, 2019 at 7:52 pm
Hello Experts,
I am working on SP that sends my csv file from on prem machine to Azure blob container. I am using lastest Azcopy v10.
DECLARE @Program varchar(200) = '"C:\AzCopy.exe"'
DECLARE @Source varchar(max) = 'E:\Backup\abc.txt'
DECLARE @Destination varchar(max) = 'https://myaccount.blob.core.windows.net/'
DECLARE @DestKey varchar(max) = 'secret key'
DECLARE @Options varchar(max) = '/S /XO /XN /Y /V:E:\Backup\AzCopy-Log.txt /Z:'
DECLARE @Cmd varchar(5000)
SELECT @Cmd = @Program +' /Source:'+ @Source +' /Dest:'+ @Destination +' /DestKey:'+ @DestKey +' '+ @Options
PRINT @cmd
EXECUTE master..xp_cmdshell @Cmd
When I run this code, I get below error
Error: unknown command "/Source:E:\\Backup\\abc.txt" for "azcopy"Run 'azcopy --help' for usage.NULLunknown command "/Source:E:\\Backup\\abc.txt" for "azcopy"NULL
September 11, 2019 at 7:56 pm
If you execute whatever is in @Cmd directly from the command line, does it work?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
September 11, 2019 at 8:03 pm
Nope, its the same error there too. Trying to fix it but not sure why its not working. if anyone has worked on similar and tell if the syntax is correct or what is the issue here? Thanks a lot.
September 11, 2019 at 9:36 pm
This command won't work unless you have already authenticated with Azure somehow ... have you done that elsewhere in your code?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
September 11, 2019 at 10:41 pm
Yes Phil. Authentication part is not an issue at all. It works. Thanks for your help.
September 11, 2019 at 10:50 pm
Yes Phil. Authentication part is not an issue at all. It works. Thanks for your help.
Np. And lucky you. The hardest part of everything I do in Azure seems to be authentication!!
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
September 11, 2019 at 11:29 pm
That Unknown Command error seemed like it started popping up a lot on version 10. Maybe try 8.1 or whatever it was previously...I think 8.1.
Sue
September 13, 2019 at 2:08 pm
Okay Sure. Thanks.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply