Azure CLI vs Powershell?

2020-02-26 15:01发布

Not precisely able to understand the merit of Azure CLI on Windows environment.

Is it targetted for the audience who want to manage Azure IAAS from Linux environment?

I thought Powershell core is going to be the way for non-Windows admins. Is PowerShell Core not going to be ported to well on all platforms, to serve the cross-platform audience?

In a nutshell, is it worth learning Azure CLI?

5条回答
不美不萌又怎样
2楼-- · 2020-02-26 15:22

Azure CLI is a PowerShell-like-tool available for all platforms. You can use the same commands no matter what platform you use: Windows, Linux or Mac.

Now, there are two version Azure CLI. The Azure CLI 1.0 was written with Node.js to achieve cross-platform capabilities, and the new Azure CLI 2.0 is written in Python to offer better cross-platform capabilities. Both are Open Source and available on Github. However, for now, only certain PowerShell cmdlets support use on Linux.

Is it targetted for the audience who want to manage Azure IAAS from Linux environment?

I think the answer is yes. For a Linux or Mac developer, I think they more likely to use Azure CLI.

查看更多
霸刀☆藐视天下
3楼-- · 2020-02-26 15:39

Powershell was not available in non-Windows platform prior to 2018. Staring Jan 2018, Powershell is available in MacOS and Linux platforms.

Installation instructions for Powershell on MacOS or Linux is available here

查看更多
\"骚年 ilove
4楼-- · 2020-02-26 15:41

Just wanted to add my experience with both Azure Cli and Az PowerShell.

As per 2019, both are cross-platform so it should only be a language/syntax preference but with Azure Cli all/most commands are idempotent.

I've ended up replacing all my ARM Templates with Azure Cli scripts as it is less verbose and easy to read.

With Az Powershell, you still need to check if the resource exists before creating it otherwise it will throw an exception so scripts can become very complicated for no reason.

We're using both Azure Cli and Az Powershell with Azure DevOps. Azure Cli command can only be executed from bash (Linux) or bat (Windows) scripts. So it is not optimum...

  • We deploy resources with Azure Cli because it is easy to read and commands are idempotent.
  • For complex scripting I prefer using PowerShell as there are a lot of useful language features.
查看更多
Fickle 薄情
5楼-- · 2020-02-26 15:41

PowerShell is Open Source too. Microsoft have just released PowerShell Azure Az module (Dec 2018), which uses .Net core. So it runs on Linux,Mac OS and Windows. Azure CLI is still there for Linux developers, if preferred.

查看更多
爱情/是我丢掉的垃圾
6楼-- · 2020-02-26 15:45

Both, Azure CLI and the PowerShell package use the REST API of Azure.

As one of our Microsoft contacts said: Use whatever you like and you prefer.

There are some pros for Azure CLI:

  1. Open Source - which has many advantages. It might be developing faster in the future. You can view what is really in the Code, the community might or will be bigger, and so on.
  2. Azure CLI can be used with Groovy, Python, Ruby or any other scripting language. It is easier to get good developers for this languages than an experienced PowerShell developer. For example: I took Groovy because of Java. It is easier to use this combination then learning PowerShell scripting....

Currently there is 1 really big positive for PowerShell: there is a huge repository of PowerShell script examples for Azure. BUT: often you have to do it on your own to fit your requirements - therefore an example might be a good starting point - sometimes it is easier to begin from scratch.

My recommendation would be: Use Azure CLI --> For Scripting use the language your company is familiar with.

查看更多
登录 后发表回答