0

I have to run SQL Azure Powershell script in SQL Azure query editor. I have done run Windows Powershell script in SQL server(Express edition) query editor of my system as

xp_cmdshell 'sqlps -command "$http=New-Object system.Net.WebClient;$http.downloadString(\"url\")"'

It was successfully called the application by the url. But when I try to use same concept in SQL Azure, I come to know there is SQL Azure Powershell. From this poweshell I can call the application by url, for that I need to open SQL Azure Powershell and write the command, I Don't want to do in this way. I want to do the way I did in SQL server that write the query to run the Powershell script, I searched a lot but I don't find how to run the SQL Azure Powershell script in SQL Azure query editor Since It doesn't support the xp_cmdshell.

can any one help me to solve this problem or refer me link where I can find material about SQL Azure Powershell

1 Answer 1

1

You can't execute powershell scripts on the SQL Azure machine because of security related issues. Why do you want to execute a powershell script, what does the script do? Perhaps there is another way of achieving your objective.

Sign up to request clarification or add additional context in comments.

7 Comments

I need to send http request or trigger external application reside in tomcat server, that's where I used Powershell script in Query editor in my local sql server.
Is there any other way to trigger application or at least send message to external java application which is there in tomcat server
Or at least I need to trigger .bat(windows)/.sh(ubuntu executable's) file from sql azure. can you help me to find my requirement to work.
Why do you need to call the http endpoint from SQL? Do you only call it when there is certain data in the database? Is tomcat hosted on an Azure VM? If that is what you're doing then you can use a windows service or Linux cron job to poll the database and make that request when it finds the required data.
CLR Stored procs, Extended stored procs and SQL agent are all not available on Azure. So there is no way to get the database to invoke your app. You have 2 options: You can get your app to watch the database every few seconds and take action when it sees new data (using something like quartz-scheduler.org) OR you can have a intermediate windows service or cron job which watches the database and invokes your app when it sees new data. Using a cron job or persistent process on your tomcat dedicated server will probably be easiest.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.