当前位置: 首页 > news >正文

azure cli的安装和使用

1 概述

azure cli是管理azure云资源的命令行工具。
官网为:

https://learn.microsoft.com/zh-cn/cli/azure/

2 安装

2.1 容器安装

docker run -it mcr.microsoft.com/azure-cli

3 登录

9d039d31f8e5:/# az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code NZL8HCV7U to authenticate.Retrieving tenants and subscriptions for the selection...[Tenant and subscription selection]No     Subscription name    Subscription ID                       Tenant
-----  -------------------  ------------------------------------  --------
[1] *  Azure 订阅 2         31948b7e-32d1-420a-968f-cda1531xxxxx  默认目录The default is marked with an *; the default tenant is '默认目录' and subscription is 'Azure 订阅 2' (31948b7e-32d1-420a-968f-cda1531xxxxx).Select a subscription and tenant (Type a number or Enter for no changes): Tenant: 默认目录
Subscription: Azure 订阅 2 (31948b7e-32d1-420a-968f-cda1531xxxxx)[Announcements]
With the new Azure CLI login experience, you can select the subscription you want to use more easily. Learn more about it and its configuration at https://go.microsoft.com/fwlink/?linkid=2271236If you encounter any problem, please open an issue at https://aka.ms/azclibug[Warning] The login output has been updated. Please be aware that it no longer displays the full list of available subscriptions by default.

提示用浏览器打开网址https://microsoft.com/devicelogin,并输入在命令行打印信息中显示的一个指定的码,即可登录。


4 命令

4.1 列出VPC

9d039d31f8e5:/# az network vnet list -o table
Name     ResourceGroup    Location        NumSubnets    Prefixes     DnsServers    DDOSProtection    VMProtection
-------  ---------------  --------------  ------------  -----------  ------------  ----------------  --------------
ab-vnet  aaa              northcentralus  1             10.0.0.0/16                False

4.2 列出负载均衡器

9d039d31f8e5:/# az network lb list -o table
Location        Name     ProvisioningState    ResourceGroup    ResourceGuid
--------------  -------  -------------------  ---------------  ------------------------------------
northcentralus  demo-lb  Succeeded            aaa              f3752990-b598-4aab-a04b-4979219e989c

4.3 列出虚拟机

9d039d31f8e5:/# az vm list -o table
Name    ResourceGroup    Location        Zones
------  ---------------  --------------  -------
ab      AAA              northcentralus9d039d31f8e5:/# az vm list
[{"additionalCapabilities": {"hibernationEnabled": false,"ultraSsdEnabled": null},"applicationProfile": null,"availabilitySet": null,"billingProfile": null,"capacityReservation": null,"diagnosticsProfile": {"bootDiagnostics": {"enabled": true,"storageUri": null}},"etag": null,"evictionPolicy": null,"extendedLocation": null,"extensionsTimeBudget": null,"hardwareProfile": {"vmSize": "Standard_D4s_v3","vmSizeProperties": null},"host": null,"hostGroup": null,"id": "/subscriptions/31948b7e-32d1-420a-968f-cda1531xxxxx/resourceGroups/AAA/providers/Microsoft.Compute/virtualMachines/ab","identity": {"principalId": "f3f7a5a4-20b7-48de-aee8-b8eb67c457d7","tenantId": "f6f134f0-dbf3-46f2-8ef8-ae6e0ad1c9eb","type": "SystemAssigned","userAssignedIdentities": null},"instanceView": null,"licenseType": null,"location": "northcentralus","managedBy": null,"name": "ab","networkProfile": {"networkApiVersion": null,"networkInterfaceConfigurations": null,"networkInterfaces": [{"deleteOption": "Detach","id": "/subscriptions/31948b7e-32d1-420a-968f-cda1531xxxxx/resourceGroups/aaa/providers/Microsoft.Network/networkInterfaces/ab724","primary": null,"resourceGroup": "aaa"}]},"osProfile": {"adminPassword": null,"adminUsername": "lj","allowExtensionOperations": true,"computerName": "ab","customData": null,"linuxConfiguration": {"disablePasswordAuthentication": false,"enableVmAgentPlatformUpdates": null,"patchSettings": {"assessmentMode": "ImageDefault","automaticByPlatformSettings": {"bypassPlatformSafetyChecksOnUserSchedule": false,"rebootSetting": "IfRequired"},"patchMode": "AutomaticByPlatform"},"provisionVmAgent": true,"ssh": null},"requireGuestProvisionSignal": true,"secrets": [],"windowsConfiguration": null},"plan": null,"platformFaultDomain": null,"priority": null,"provisioningState": "Succeeded","proximityPlacementGroup": null,"resourceGroup": "AAA","resources": null,"scheduledEventsPolicy": null,"scheduledEventsProfile": null,"securityProfile": {"encryptionAtHost": null,"encryptionIdentity": null,"proxyAgentSettings": null,"securityType": "TrustedLaunch","uefiSettings": {"secureBootEnabled": true,"vTpmEnabled": true}},"storageProfile": {"dataDisks": [],"diskControllerType": "SCSI","imageReference": {"communityGalleryImageId": null,"exactVersion": "20.04.202405130","id": null,"offer": "0001-com-ubuntu-server-focal","publisher": "canonical","sharedGalleryImageId": null,"sku": "20_04-lts-gen2","version": "latest"},"osDisk": {"caching": "ReadWrite","createOption": "FromImage","deleteOption": "Delete","diffDiskSettings": null,"diskSizeGb": 128,"encryptionSettings": null,"image": null,"managedDisk": {"diskEncryptionSet": null,"id": "/subscriptions/31948b7e-32d1-420a-968f-cda1531xxxxx/resourceGroups/aaa/providers/Microsoft.Compute/disks/ab_OsDisk_1_d073c751c80543e086b3de893bb1fc22","resourceGroup": "aaa","securityProfile": null,"storageAccountType": "Standard_LRS"},"name": "ab_OsDisk_1_d073c751c80543e086b3de893bb1fc22","osType": "Linux","vhd": null,"writeAcceleratorEnabled": null}},"tags": null,"timeCreated": "2024-06-04T16:51:03.359635+00:00","type": "Microsoft.Compute/virtualMachines","userData": null,"virtualMachineScaleSet": null,"vmId": "b4c7523a-87a9-4476-96e8-5bd8808xxxxx","zones": null}
]

4.4 列出mysql

9d039d31f8e5:/# az mysql flexible-server list -o table 
Name    Resource Group    Location          Version    Storage Size(GiB)    Tier       SKU            State    HA State    Availability zone
------  ----------------  ----------------  ---------  -------------------  ---------  -------------  -------  ----------  -------------------
abc     aaa               North Central US  8.0.21     20                   Burstable  Standard_B1ms  Ready    NotEnabled

5 小结

本文介绍azure cli的容器情景的安装和列表型命令的使用。

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 硬件工程师学习规划
  • 多客圈子论坛系统 httpGet 任意文件读取漏洞复现
  • 臻奶惠的行业优势与市场竞争力解析
  • Spring-Security(一)-源码分析及认证流程
  • 电子元器件批发的几种模式
  • 嵌入式C语言面试题笔试题
  • 华为和锐捷设备流统配置
  • Androidstudio项目加载不出来,显示Connect timed out
  • Android 应用加固与重签名—使用AndroidStudio自带工具 apksigner
  • go语言后端开发学习(一)——JWT的介绍以及基于JWT实现登录验证
  • 项目:基于httplib/消息队列负载均衡式在线OJ
  • 【计算机网络】个人学习笔记——第四章 网络层:CIDR编址IP地址子网掩码ICMP路由聚合与子网划分ARP协议
  • 工业无线通信解决方案,企业在进行智能化升级改造
  • vue3模板语法总结
  • ios 获取图片的一部分区域
  • 深入了解以太坊
  • Joomla 2.x, 3.x useful code cheatsheet
  • PyCharm搭建GO开发环境(GO语言学习第1课)
  • Python3爬取英雄联盟英雄皮肤大图
  • Quartz初级教程
  • SQL 难点解决:记录的引用
  • thinkphp5.1 easywechat4 微信第三方开放平台
  • vue:响应原理
  • vue-router的history模式发布配置
  • vue从入门到进阶:计算属性computed与侦听器watch(三)
  • vue脚手架vue-cli
  • 盘点那些不知名却常用的 Git 操作
  • 深度学习入门:10门免费线上课程推荐
  • 时间复杂度与空间复杂度分析
  • 一文看透浏览器架构
  • 阿里云ACE认证之理解CDN技术
  • 扩展资源服务器解决oauth2 性能瓶颈
  • 你学不懂C语言,是因为不懂编写C程序的7个步骤 ...
  • ​iOS安全加固方法及实现
  • #Linux杂记--将Python3的源码编译为.so文件方法与Linux环境下的交叉编译方法
  • (12)目标检测_SSD基于pytorch搭建代码
  • (16)Reactor的测试——响应式Spring的道法术器
  • (day 12)JavaScript学习笔记(数组3)
  • (pojstep1.3.1)1017(构造法模拟)
  • (二)fiber的基本认识
  • (附源码)spring boot校园健康监测管理系统 毕业设计 151047
  • (附源码)springboot车辆管理系统 毕业设计 031034
  • (附源码)ssm高校升本考试管理系统 毕业设计 201631
  • (附源码)ssm户外用品商城 毕业设计 112346
  • (已更新)关于Visual Studio 2019安装时VS installer无法下载文件,进度条为0,显示网络有问题的解决办法
  • (原創) 如何將struct塞進vector? (C/C++) (STL)
  • (原創) 如何解决make kernel时『clock skew detected』的warning? (OS) (Linux)
  • (转)拼包函数及网络封包的异常处理(含代码)
  • ***原理与防范
  • .NET WPF 抖动动画
  • .NET 使用 ILMerge 合并多个程序集,避免引入额外的依赖
  • .NET/C# 阻止屏幕关闭,阻止系统进入睡眠状态
  • .net8.0与halcon编程环境构建
  • .NetCore Flurl.Http 升级到4.0后 https 无法建立SSL连接
  • .php结尾的域名,【php】php正则截取url中域名后的内容