Azure SQL Publish build task is not supported on agent Hosted Linux Preview:
The current operating system is not capable of running this task. That typically means the task was written for Windows only. For example, written for Windows Desktop PowerShell.
Are there any other options available that will allow me to migrate my Azure SQL database during deployment?
@severisv
I would like to understand your scenario before suggesting a solution to the problem. Please share your email Id so that we can plan for a call to look into this issue.
Few basic questions :
We are using Entity Framework Core. Previously we would have dotnet ef create an SQL script that we would run agaist the Database through the Azure SQL Publish task.
After changing to a Hosted Linux Preview agent, we no longer have a way of running the SQL script against the database during deployment.
@severisv
Azure SQL task is currently supported only for Windows-based agent system. We are adding this to our backlog and will consider adding this support in the future.
I suggest to try out below-mentioned solutions as of now:
I hope this would be helpful.
@severisv
Closing this issue assuming you are unblocked on this issue.
Facing the same issue with below error.
#[error]The current operating system is not capable of running this task. That typically means the task was written for Windows only. For example, written for Windows Desktop PowerShell.
Can you please tell me what is wrong with my task?
@Akreddy123
Generally this issue occurs, if you are using PS based task or Node based task with dependency on windows platform tool and running the task on Linux agent.
Can you please provide following information :
PS handler works only in Windows. If you need support in Linux, you will have to use Node handler. You can refer the PS task that we have as an example:
https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/PowerShellV2/task.json
@kmkumaran : In the above task, you are using 2 separate targets for power shell and node. In our task, we use some commands of Az modules and our AzSK module.
Is there a way other than using 2 separate targets?
If you need only one handler, you can then go with just Node handler. The above task is an example where task has an option to specify two handlers and the best handler will be picked based on operating system. But if you always want to use Node, you can then have only Node handler. The same repo has other tasks which uses only Node handler. You can also refer them as examples.
I have to use the PS handler since I use PS commands in my task.
Is there a way other than using Node to make it work on Linux agent?
Today, the only handler we support for Linux is Node. You can use Powershell core, which can let you execute powershell commands in both Windows and Linux. You can then use Node handler and follow similar approach as in the Powershell task to run your scripts (ps commands) in Powershell core.
Adding @ericsciple if there are any other suggestions.
@kmkumaran : We are using PowerShell core only. That's why the commands we use in the above task are running on Linux and Mac VMs.
My question is what should I do to make my task run on Hosted Ubuntu or any other Linux agent. I can't see any azure PowerShell command in your type script file. Please let me know if it is possible to run any azure PowerShell command in a type script file or is there a way other than using Node.
@kmkumaran @ericsciple @Ajay-MS : Could you please respond to my comment. We are relying on this for our production.
@Akreddy123 - I believe having Node handler is the only option for you. With regard to your observation of lack of PowerShell commands in the sample type script, Please note that this task takes a PS script (inline or file) as user input and executes them. Hence you don't see the PS commands in the task file. But the functionality that it does - to be able to execute a PS script using pwsh would be of interest to you.
Is there any plan to provide SQL task that works on Linux too or at least instruction how to do it? Unfortunatelly instruction like that:
- Install MS SQL tools on linux agent
- Use bash script task to run script.
Is quite short.
Most helpful comment
Is there any plan to provide SQL task that works on Linux too or at least instruction how to do it? Unfortunatelly instruction like that:
Is quite short.