Azure Cloud Shell 之Bash 快速入门

前面我们了解了Azure Cloud Shell概述以及Azure Powershell 入门,现在我们在来了解下Azure Cloud Shell中的Bash 快速入门。

1.登录Azure Portal ,启动CloudShell

从导航栏中 启动Cloud Shell,如下图

image

切换到Bash

image

点击确认,从而切换到Bash


image

进入Bash环境

image

2.查看并设置首选订阅

使用az account list查看

image

使用az account set 设置首选订阅

image

3.创建资源组

在 EastUS 中创建一个名为“TestBash”的新资源组。输入以下命令 az group create --location eastus --name TestBash

image

4.创建 Linux VM

在新资源组中创建 Ubuntu VM。 在Bash中输入以下命令az vm create -n BashQS -g TestBash --image UbuntuLTS --generate-ssh-keys,Azure CLI 将创建 SSH 密钥并使用它们创建设置 VM。

image

5.通过SSH链接Linux VM

在门户当中找到刚才创建的虚拟机,如下图。

image

点击连接—SSH,找到“使用VM本地账户登录”,复制文本框中的字符串,如下图

SNAGHTML70f2d83

将复制的ssh命令,粘贴到Bash窗口中 ssh [email protected],连接成功后,可以看到欢迎界面,如下图

image

可以查看主机名和IP地址

image

6.清除

使用exit命令退出ssh

image

使用az group delete命令删除刚才创建的资源组及其下的所有资源

image

猜你喜欢

转载自blog.51cto.com/fjcloud/2355821