I suspect the batch job runs under a different userid that can't access Azure.
The SAS session and batch are run on the same machine. Is it possible they are under different user ids? Do you know where and how can I find this id?
Add
%put xxx&azure_token.xxx;
to your code and inspect/compare the logs.
In SAS session, the token looks ok, but in batch mode, the macro is not resolved because of 400 bad request. The log shows xxxxxx.
The fact that it is not resolved is the cause for the 400 error. Look where the macro variable is defined in your interactive session.
I don't see a variable &path. I do see &pathx
url= "&pathx.?restype=directory&include=timestamps&comp=list"
I also do not see where &path or &pathx is set. So without that bit of info I would say that is the likely problem: the macro variable with the path is not assigned, or assigned incorrectly in batch mode.
Where is the LOG created when you run this? I see several things that SAS might complain about as undefined macro variables that are URL elements.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.