question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure CLI task - Upgrade to Modern Shell?

See original GitHub issue

It appears Azure CLI task uses batch/CMD.exe as the shell interpreter. image Can we get this to use something more modern? Powershell? Bash?

Is there some reason cmd.exe/batch was chosen here that makes something like Powershell or Bash not feasible options? I want to add some logic within Azure CLI tasks and having to implement that logic in batch is right up there of putting it in a vbscript.

Alternatively, Is there a (sane) way to get the azure cli and particularly the service principal identity login step into another step? In other words, run the Azure CLI task and then follow it up with a Bash or Powershell task that contains more logic, that ones run through, executes some az cli command.

_ _ EDIT [May 2019]: On Windows agents, I would suggest using Azure Powershell (>=4.* version) task instead of Azure CLI task. It uses the newer Az powershell module (not the legacy AzureRM module, and also not Azure CLI python executable).

You WILL still have to rewrite/re-research your Azure CLI commands into Az Powershell specific language. This change doesn’t buy you much, but Az Powershell supposedly multi-platform, allowing in theory same code on both Windows and Linux agents.

I still very much prefer Azure CLI syntax over the Az Powershell syntax (Az Powershell appears to rely on very long naming of cmdlets):

az webapp deployment list-publishing-profiles -n $WEBAPPNAME-g $RSGROUP

Get-AzWebAppContainerContinuousDeploymentUrl -ResourceGroupName $RSGROUP -Name $WEBAPPNAME

Ultimately, this doesn’t change what issue wants: Azure CLI within Powershell (not AzureRM, not Az Powershell module) END Edit

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:23
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
markusfosscommented, Feb 6, 2019

I agree with @pulkitaggarwl . Being forced to use cmd/batch is a severe step in the wrong direction. Ie. building up a blob store sastoken, and using it to download a linked template proves to be very hard (especially if you compare it with how easy it is done in az cli). Please prioritize this feature req 😉

5reactions
StefanSchoofcommented, Nov 21, 2017

A other workaround is to change the azure cli task to a inline script and write:

powershell -File $(System.DefaultWorkingDirectory)/path/to/your.ps1
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to update the Azure CLI | Microsoft Learn
Learn how to update the Azure Command-Line Interface (CLI) by performing a manual update or enabling auto-upgrade for the CLI.
Read more >
Azure Cloud Shell – Browser-Based Command Line
A browser-based shell experience in the cloud that's maintained by Microsoft to manage Azure resources with popular command-line tools and programming ...
Read more >
Release notes & updates – Azure CLI - Microsoft Learn
Learn about the latest Azure Command-Line Interface (CLI) release notes and updates for both the current and beta versions of the CLI.
Read more >
Announcing Azure CLI Shell (Preview); more Azure CLI 2.0 ...
Azure CLI 2.0 provides an idiomatic command line interface that integrates natively with Bash and POSIX tools. It is easy to install, ...
Read more >
AzureCLI@2 - Azure CLI v2 task - Microsoft Learn
Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found