Search code examples
powershellu-sql

No method to invoke USQL programmatically works


When I run Powershell command to submit a USQL job

Import-AzureRmContext -Path "c:\temp\Azure.json"
$adla = Get-AdlAnalyticsAccount -ResourceGroupName "test" -Name "dla"
Submit-AdlJob -Account $adla -Name "test" –ScriptPath "C:\temp\temp.usql"

Submit-AdlJob returns error:

Message        : An error occurred while sending the request.
Data           : {}
InnerException : System.Net.WebException: The remote name could not be resolved: 'microsoft.azure.commands.datalakeanalytics.models.psdatalakeanalyticsaccount.azuredatalakeanalytics.net'
                    at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
                    at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)

When I try AzureCLI, it doesn't work - azurecli isn't found. I find the installation is really not working fine on Windows but workarounds don't work too.

When I try .NET, I also face issues.

Anyway, it'd be nice if Powershell worked. Any idea what's the solution ? (When I submit it using portal it works.)

Thanks!


Solution

  • At least for Powershell, your problem is the parameter -Account in Submit-AdlJob just wants the name of the ADLA account. You're passing in the entire object representing the ADLA account that you got from Get-AdlAnalyticsAccount. Try resubmitting the job with just:

    Submit-AdlJob -Account "dla" -Name "test" -ScriptPath "C:\temp\temp.usql"