MCPInstall

azure-cli

Azure CLI 操作

Installs
83
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/chaterm/terminal-skills --skill azure-cli
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads azure-cli automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Azure CLI 操作

概述

Azure 资源管理、AKS、存储操作等技能。

配置与认证

# 登录
az login
az login --use-device-code          # 设备代码登录
az login --service-principal -u <app-id> -p <password> --tenant <tenant-id>

# 查看账户
az account show
az account list --output table

# 切换订阅
az account set --subscription "subscription-name"
az account set --subscription "subscription-id"

# 查看当前配置
az configure --list-defaults

# 设置默认值
az configure --defaults group=myResourceGroup location=eastus

资源组

# 列出资源组
az group list --output table

# 创建资源组
az group create --name myResourceGroup --location eastus

# 删除资源组
az group delete --name myResourceGroup --yes --no-wait

# 查看资源组中的资源
az resource list --resource-group myResourceGroup --output table

虚拟机

VM 管理

# 列出 VM
az vm list --output table
az vm list --resource-group myResourceGroup --output table

# 创建 VM
az vm create \
    --resource-group myResourceGroup \
    --name myVM \
    --image Ubuntu2204 \
    --admin-username azureuser \
    --generate-ssh-keys \
    --size Standard_B2s

# 启动/停止 VM
az vm start --resource-group myResourceGroup --name myVM
az vm stop --resource-group myResourceGroup --name myVM
az vm deallocate --resource-group myResourceGroup --name myVM
az vm restart --resource-group myResourceGroup --name myVM

# 删除 VM
az vm delete --resource-group myResourceGroup --name myVM --yes

# 查看 VM 详情
az vm show --resource-group myResourceGroup --name myVM
az vm get-instance-view --resource-group myResourceGroup --name myVM

VM 操作

# 获取公网 IP
az vm list-ip-addresses --resource-group myResourceGroup --name myVM --output table

# 打开端口
az vm open-port --resource-group myResourceGroup --name myVM --port 80

# 调整大小
az vm resize --resource-group myResourceGroup --name myVM --size Standard_D4s_v3

# 运行命令
az vm run-command invoke \
    --resource-group myResourceGroup \
    --name myVM \
    --command-id RunShellScript \
    --scripts "apt-get update && apt-get install -y nginx"

存储账户

账户管理

# 列出存储账户
az storage account list --output table

# 创建存储账户
az storage account create \
    --name mystorageaccount \
    --resource-group myResourceGroup \
    --location eastus \
    --sku Standard_LRS

# 获取连接字符串
az storage account show-connection-string \
    --name mystorageaccount \
    --resource-group myResourceGroup

# 获取密钥
az storage account keys list \
    --account-name mystorageaccount \
    --resource-group myResourceGroup

Blob 操作

# 设置环境变量
export AZURE_STORAGE_CONNECTION_STRING="..."

# 创建容器
az storage container create --name mycontainer

# 列出容器
az storage container list --output table

# 上传文件
az storage blob upload \
    --container-name mycontainer \
    --name myblob \
    --file ./local-file.txt

# 下载文件
az storage blob download \
    --container-name mycontainer \
    --name myblob \
    --file ./downloaded-file.txt

# 列出 blob
az storage blob list --container-name mycontainer --output table

# 删除 blob
az storage blob delete --container-name mycontainer --name myblob

# 生成 SAS URL
az storage blob generate-sas \
    --container-name mycontainer \
    --name myblob \
    --permissions r \
    --expiry 2024-12-31 \
    --full-uri

AKS 集群

# 列出集群
az aks list --output table

# 创建集群
az aks create \
    --resource-group myResourceGroup \
    --name myAKSCluster \
    --node-count 3 \
    --node-vm-size Standard_D2s_v3 \
    --generate-ssh-keys

# 获取凭证
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster

# 查看集群
az aks show --resource-group myResourceGroup --name myAKSCluster

# 扩缩节点
az aks scale \
    --resource-group myResourceGroup \
    --name myAKSCluster \
    --node-count 5

# 升级集群
az aks get-upgrades --resource-group myResourceGroup --name myAKSCluster
az aks upgrade --resource-group myResourceGroup --name myAKSCluster --kubernetes-version 1.28.0

# 删除集群
az aks delete --resource-group myResourceGroup --name myAKSCluster --yes

App Service

# 列出 App Service 计划
az appservice plan list --output table

# 创建 App Service 计划
az appservice plan create \
    --name myAppServicePlan \
    --resource-group myResourceGroup \
    --sku B1 \
    --is-linux

# 创建 Web App
az webapp create \
    --resource-group myResourceGroup \
    --plan myAppServicePlan \
    --name myWebApp \
    --runtime "NODE:18-lts"

# 部署代码
az webapp deployment source config-zip \
    --resource-group myResourceGroup \
    --name myWebApp \
    --src app.zip

# 查看日志
az webapp log tail --resource-group myResourceGroup --name myWebApp

常见场景

场景 1:批量操作资源

# 列出所有 VM 并停止
az vm list --query "[].{name:name, rg:resourceGroup}" -o tsv | \
while read name rg; do
    az vm deallocate --resource-group "$rg" --name "$name" --no-wait
done

场景 2:导出资源模板

# 导出资源组模板
az group export --name myResourceGroup > template.json

# 部署模板
az deployment group create \
    --resource-group myResourceGroup \
    --template-file template.json \
    --parameters @parameters.json

场景 3:监控与日志

# 查看活动日志
az monitor activity-log list \
    --resource-group myResourceGroup \
    --start-time 2024-01-01 \
    --output table

# 查看指标
az monitor metrics list \
    --resource /subscriptions/.../resourceGroups/.../providers/Microsoft.Compute/virtualMachines/myVM \
    --metric "Percentage CPU" \
    --interval PT1H

故障排查

问题排查方法
登录失败az login --use-device-code
权限不足检查 RBAC 角色分配
资源找不到检查订阅、资源组
配额超限az vm list-usage --location eastus
# 调试模式
az vm list --debug

# 查看帮助
az vm --help
az vm create --help

FAQ

What does the azure-cli skill do?

Azure CLI 操作

How do I install azure-cli?

Run npx skills add https://github.com/chaterm/terminal-skills --skill azure-cli in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/azure-cli/ (personal) or .claude/skills/azure-cli/ (project).

Which AI agents can use azure-cli?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is azure-cli safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains azure-cli?

It is published by chaterm in chaterm/terminal-skills. It has 83 recorded installs.

More from chaterm/terminal-skills

View all →

cron

chaterm/terminal-skills

定时任务管理

1.3K installs

system-admin

chaterm/terminal-skills

Linux system administration and monitoring

DevOps & Cloud561 installs

systemd

chaterm/terminal-skills

Open the skill to read its SKILL.md instructions.

253 installs

network-tools

chaterm/terminal-skills

Linux network tools and diagnostics

DevOps & Cloud218 installs

vpn

chaterm/terminal-skills

VPN 配置与管理

193 installs

ssh

chaterm/terminal-skills

SSH 管理与安全

147 installs

Popular devops & cloud skills

View category →

microsoft-foundry

microsoft/azure-skills

Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure

OfficialDevOps & Cloud579.1K installs

azure-diagnostics

microsoft/azure-skills

Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.

OfficialDevOps & Cloud569.8K installs

azure-prepare

microsoft/azure-skills

Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.

OfficialDevOps & Cloud569K installs

azure-ai

microsoft/azure-skills

Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.

OfficialDevOps & Cloud568.8K installs

azure-deploy

microsoft/azure-skills

Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.

OfficialDevOps & Cloud568.6K installs

azure-validate

microsoft/azure-skills

Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.

OfficialDevOps & Cloud568K installs