sâmbătă, 4 martie 2017

Exploring the new DevOps - Azure Command Line Interface 2.0 (CLI)


Azure CLI 2.0I am an enormous fan of the command line, and generally I really feel like Home windows individuals are missing out on the power of text mode. Thankfully, in the present day Home windows 10 has bash (via Ubuntu on Windows 10), PowerShell, and "basic" CMD. I exploit all three, myself.

Five years ago I began managing my Azure cloud internet apps utilizing the Azure CLI. I have been an enormous fan of it ever since. It was written in node.js, it labored the identical all over the place, and it obtained the job achieved.

Quick ahead to in the present day and the Azure workforce simply announced a complete Azure CLI re-write, and now 2.0 is out, today. Initially I used to be involved it had been re-written and did not perceive the philosophy behind it. However I perceive it now. Whereas it really works on Home windows (my every day driver) it is architecturally aligned with Mac and (largely, IMHO) Linux customers. It additionally helps new considering round a contemporary command line with assist for issues like JMESPath, a question language for JSON. It really works properly and clearly with the same old suspects after all, like grep, jq, minimize, and many others. It is simply installed with pip, otherwise you simply get Python Three.5.x after which simply "pip set up --user azure-cli."

Linux folks (be at liberty to examine the script) can simply do that curl, however it's also in apt-get, after all.

curl -L https://aka.ms/InstallAzureCli | bash

NOTE: Since I have already got the older Azure CLI 1.zero on my machine, it is helpful to notice that these two CLIs can stay on the identical machine. The brand new one is "az" and the older is "azure," so no issues there.

Or, for these of you who run particular person Docker containers to your instruments (or should you're simply desirous to discover) you'll be able to

docker run -v $:/root -it azuresdk/azure-cli-python:

Then I simply "az login" and I am off! Right here I will question my subscriptions:

C:UsersscottDesktop> az account record --output desk

Title CloudName Sub State IsDefault

------------------------------------------- ----------- --- ------- -----------

Three-Month Free Trial AzureCloud 0f3 Enabled

Pay-As-You-Go AzureCloud 34c Enabled

Home windows Azure MSDN AzureCloud ffb Enabled True

At this level, it is already feeling acquainted. It is "az noun verb" and there is an non-compulsory --output parameter. If I do not embody --output by default I will get JSON...which I can then question with JMESPath if I might like. (These of us who're older could also be having somewhat XML/XPath/XQuery déjà vu)


I can use JSON, TSV, tables, and even "colorized json" or JSONC.

C:UsersscottDesktop> az appservice plan record --output desk 

AppServicePlanName GeoRegion Type Location Standing

-------------------- ---------------- ------ ---------------- --------

Default1 North Central US app North Central US Prepared

Default1 Southeast Asia app Southeast Asia Prepared

Default1 West Europe app West Europe Prepared

DefaultServerFarm West US app West US Prepared

myEchoHostingPlan North Central US app North Central US Prepared

I could make and handle mainly something. Right here I will make a brand new App Service Plan and put two internet apps in it, all managed in a gaggle:

az group create -n MyResourceGroup
# Create an Azure AppService that we will use to host a number of internet apps

az appservice plan create -n MyAppServicePlan -g MyResourceGroup


# Create two internet apps inside the appservice (observe: title param have to be a singular DNS entry)

az appservice internet create -n MyWebApp43432 -g MyResourceGroup --plan MyAppServicePlan

az appservice internet create -n MyWEbApp43433 -g MyResourceGroup --plan MyAppServicePlan

You is perhaps considering this appears to be like like PowerShell. Why not use PowerShell? Bear in mind this is not for Home windows primarily. There is a ton of DevOps taking place in Python on Linux/Mac and this matches very properly into that. For these of us (myself included) who're PowerShell followers, PowerShell has massive and complete Azure Support. After all, whereas the bash people might want to use JMESPath to simulate passing objects round, PowerShell can carry on preserving on. There is a command line for everybody.

It’s straightforward to get began with the CLI at http://aka.ms/CLI and be taught in regards to the command line with docs and samples. Take a look at matters like installing and updating the CLI, working with Virtual Machines, making a complete Linux environment together with VMs, Scale Units, Storage, and community, and deploying Azure Web Apps – and allow them to know what you suppose at azfeedback@microsoft.com. Additionally, as all the time, the Azure CLI 2.zero is open supply and on GitHub.


Sponsor: Take a look at JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, check, construct and debug ASP.NET, .NET Framework, .NET Core, or Unity functions. Learn more and get access to early builds!




© 2016 Scott Hanselman. All rights reserved.

     

Niciun comentariu:

Trimiteți un comentariu