diff --git a/plugin/skills/azure-create-app/SKILL.md b/plugin/skills/azure-create-app/SKILL.md new file mode 100644 index 00000000..05fea101 --- /dev/null +++ b/plugin/skills/azure-create-app/SKILL.md @@ -0,0 +1,170 @@ +--- +name: azure-create-app +description: Create Azure-ready application configurations using Azure Developer CLI (azd). USE THIS SKILL when users want to prepare their application for Azure deployment, create azure.yaml, generate infrastructure files, or set up azd projects. Trigger phrases include "prepare for Azure", "create azure.yaml", "set up azd", "generate infrastructure", "configure for Azure", "make this Azure-ready", "deploy to Azure", "azd init", etc. +--- + +# Azure Create App Skill + +Create Azure-ready application configurations using Azure Developer CLI (azd). This skill generates the required configuration files for Azure deployment. + +--- + +## Execution Flow + +Execute these steps in order. + +### Step 1: Check Existing State + +Check for existing configuration files: + +**If `azure.yaml` exists:** +- Project is already configured for Azure +- User may need to update configuration or deploy (use azure-deploy skill) +- Ask user if they want to regenerate configuration + +**If `azd-arch-plan.md` exists but no `azure.yaml`:** +- Read `azd-arch-plan.md` to determine last completed phase +- Resume from the incomplete phase + +**If neither file exists:** +- Proceed to Step 2 (Discovery) + +### Step 2: Discovery Analysis + +Call the `azure__azd` MCP tool with the `discovery_analysis` command: +```javascript +await azure__azd({ + command: "discovery_analysis", + parameters: {} +}); +``` + +This tool returns instructions to: +- Scan the file system recursively +- Identify programming languages and frameworks +- Classify components (web apps, APIs, databases, etc.) +- Map dependencies between components +- Create `azd-arch-plan.md` with findings + +Execute the returned instructions before proceeding. + +### Step 3: Architecture Planning + +Call the `azure__azd` MCP tool with the `architecture_planning` command: +```javascript +await azure__azd({ + command: "architecture_planning", + parameters: {} +}); +``` + +This tool returns instructions to: +- Select appropriate Azure services for each component +- Plan hosting strategy +- Design containerization approach if needed +- Update `azd-arch-plan.md` with service selections + +Execute the returned instructions before proceeding. + +### Step 4: File Generation + +Call these MCP tools in sequence using `azure__azd`: + +**4a. Get IaC rules:** +```javascript +await azure__azd({ + command: "iac_generation_rules", + parameters: {} +}); +``` + +**4b. Generate Dockerfiles (if containerizing):** +```javascript +await azure__azd({ + command: "docker_generation", + parameters: {} +}); +``` + +**4c. Generate Bicep templates:** +```javascript +await azure__azd({ + command: "infrastructure_generation", + parameters: {} +}); +``` + +**4d. Generate azure.yaml:** +```javascript +await azure__azd({ + command: "azure_yaml_generation", + parameters: {} +}); +``` + +Each tool returns instructions. Execute them before calling the next tool. + +**Required output files:** +- `azure.yaml` - Always required +- `infra/main.bicep` - Always required +- `infra/main.parameters.json` - Always required +- `Dockerfile` - Required for Container Apps or AKS hosts + +### Step 5: Validation (REQUIRED) + +**This step is mandatory. Do not proceed to Step 6 until validation completes without errors.** + +Call the `azure__azd` MCP tool with the `project_validation` command: +```javascript +await azure__azd({ + command: "project_validation", + parameters: {} +}); +``` + +This tool returns instructions to validate: +- azure.yaml against schema +- Bicep template compilation +- AZD environment configuration +- Package building +- Provision preview + +**For quick azure.yaml-only validation:** +```javascript +await azure__azd({ + command: "validate_azure_yaml", + parameters: { path: "./azure.yaml" } +}); +``` + +Resolve ALL validation errors before proceeding. Repeat validation until zero errors are returned. + +### Step 6: Complete + +Configuration is complete. Inform the user: +- `azure.yaml` and infrastructure files are ready +- To deploy, use the azure-deploy skill + +--- + +## Reference Guides + +Load these guides as needed: + +**Discovery & Planning:** + +- [Application Type Detection](./reference/app-type-detection.md) - Patterns for identifying application types +- [Service Selection Rules](./reference/service-selection.md) - Mapping components to Azure services + +**Configuration:** + +- [azure.yaml Configuration](./reference/azure-yaml-config.md) - Configuration file reference +- [Error Handling](./reference/error-handling.md) - Troubleshooting and common errors + +**Service-Specific Details:** + +- [Static Web Apps Guide](../azure-deploy/reference/static-web-apps.md) +- [Container Apps Guide](../azure-deploy/reference/container-apps.md) +- [Azure Functions Guide](../azure-deploy/reference/functions.md) +- [App Service Guide](../azure-deploy/reference/app-service.md) +- [AKS Guide](../azure-deploy/reference/aks.md) diff --git a/plugin/skills/azure-deploy/reference/aks.md b/plugin/skills/azure-create-app/reference/aks.md similarity index 92% rename from plugin/skills/azure-deploy/reference/aks.md rename to plugin/skills/azure-create-app/reference/aks.md index 9bb47812..ea03f8f7 100644 --- a/plugin/skills/azure-deploy/reference/aks.md +++ b/plugin/skills/azure-create-app/reference/aks.md @@ -28,18 +28,19 @@ Azure Kubernetes Service (AKS) is a managed Kubernetes container orchestration s --- -## Preferred: Use azd for Deployments +## Always Use azd for Deployments -> **Prefer `azd` (Azure Developer CLI) over raw `az aks create` commands for deployments.** -> Use `az` CLI for resource queries, cluster management, or when explicitly requested. +> **Always use `azd` (Azure Developer CLI) for Azure provisioning and AKS deployments.** +> The `azd` tool provides a complete, reproducible deployment workflow for all AKS scenarios. ```bash -# Deploy everything - THIS IS THE MOST PREFERRED WAY -azd up - -# For automation/agent scenarios - use --no-prompt +# Deploy everything - THIS IS THE REQUIRED APPROACH azd up --no-prompt +# Or step-by-step: +azd provision --no-prompt # Create AKS cluster, ACR, networking +azd deploy --no-prompt # Deploy application to cluster + # Preview changes before deployment azd provision --preview @@ -57,17 +58,13 @@ azd down --force --purge > > Always back up important data before running `azd down`. -**Why azd is preferred:** +**Why azd is required:** - **Parallel provisioning** - Deploys in seconds, not minutes - **Automatic ACR integration** - No image pull failures or manual credential setup -- **Single command** - `azd up` replaces 5+ `az` commands +- **Single command** - `azd up` replaces 5+ commands - **Reproducible** - Infrastructure as Code with Bicep - **Environment management** - Easy dev/staging/prod separation -- **Use az for queries only** - `az aks show`, `az aks list`, `az aks get-credentials` - -**When `az` CLI is acceptable:** -- Quick prototyping or one-off cluster creation -- User explicitly requests `az` CLI +- **Consistent workflow** - Same commands work across all Azure services --- @@ -75,10 +72,10 @@ azd down --force --purge | Property | Value | |----------|-------| -| CLI prefix | `az aks` | +| Deployment tool | `azd` (Azure Developer CLI) | | MCP tools | `azure__aks` (commands: `aks_cluster_list`, `aks_nodepool_list`) | | Best for | Complex microservices, full K8s control | -| Prerequisites | Docker, kubectl, Azure CLI, azd | +| Prerequisites | Docker, kubectl, azd | --- @@ -86,22 +83,10 @@ azd down --force --purge ### Required Tools -**Azure CLI:** -```bash -# macOS -brew install azure-cli - -# Windows -winget install Microsoft.AzureCLI - -# Linux -curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash -``` - **Azure Developer CLI (azd):** ```bash # macOS -brew install azd +brew tap azure/azure-dev && brew install azd # Windows winget install Microsoft.Azd @@ -112,15 +97,15 @@ curl -fsSL https://aka.ms/install-azd.sh | bash **kubectl:** ```bash -# Install via Azure CLI -az aks install-cli - -# Or via package manager # macOS brew install kubectl # Windows winget install Kubernetes.kubectl + +# Linux +curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" +sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl ``` **Docker Desktop:** @@ -133,17 +118,15 @@ docker version ### Authentication ```bash -# Login to Azure -az login - -# Verify subscription -az account show --query "{name:name, id:id}" -o table +# Login to Azure with azd +azd auth login -# Set subscription if needed -az account set --subscription "" +# Verify login status +azd auth login --check-status -# Login to azd -azd auth login +# Set environment and subscription +azd env new +azd env set AZURE_SUBSCRIPTION_ID "" ``` --- @@ -151,7 +134,7 @@ azd auth login ## Pre-flight Check **Run `/azure:preflight` before deploying** to verify: -- Tools installed (az, azd, docker, kubectl) +- Tools installed (azd, docker, kubectl) - Authentication valid - Quotas sufficient - Docker running @@ -163,7 +146,7 @@ azd auth login ### MCP Tools for AKS -Use the Azure MCP server's azd tools (`azure-azd`) for validation: +Use the Azure MCP server's azd tools (`azure__azd`) for validation: | Command | Description | |---------|-------------| @@ -175,7 +158,7 @@ Use the Azure MCP server's azd tools (`azure-azd`) for validation: **Validate before deployment:** ```javascript -const validation = await azure-azd({ +const validation = await azure__azd({ command: "validate_azure_yaml", parameters: { path: "./azure.yaml" } }); @@ -245,9 +228,10 @@ output resourceGroupName string = resourceGroup().name --- -## Cluster Creation (When Manual is Required) +## Cluster Creation (Legacy Reference) -Only use these commands if the user explicitly requests manual creation or azd cannot be used. +> **⚠️ Do not use these commands.** Always use `azd up --no-prompt` for AKS deployments. +> The commands below are legacy reference only for troubleshooting or when azd absolutely cannot be used. ```bash # Set variables diff --git a/plugin/skills/azure-deploy/reference/app-service.md b/plugin/skills/azure-create-app/reference/app-service.md similarity index 93% rename from plugin/skills/azure-deploy/reference/app-service.md rename to plugin/skills/azure-create-app/reference/app-service.md index c1a22a42..d91fe789 100644 --- a/plugin/skills/azure-deploy/reference/app-service.md +++ b/plugin/skills/azure-create-app/reference/app-service.md @@ -28,18 +28,19 @@ Azure App Service is a fully managed platform-as-a-service (PaaS) for hosting we --- -## Preferred: Use azd for Deployments +## Always Use azd for Deployments -> **Prefer `azd` (Azure Developer CLI) over raw `az webapp` commands for deployments.** -> Use `az` CLI for resource queries, simple single-resource deployments, or when explicitly requested. +> **Always use `azd` (Azure Developer CLI) for Azure provisioning and App Service deployments.** +> The `azd` tool provides a complete, reproducible deployment workflow for all App Service scenarios. ```bash -# Deploy everything - THIS IS THE MOST PREFERRED WAY -azd up - -# For automation/agent scenarios - use --no-prompt +# Deploy everything - THIS IS THE REQUIRED APPROACH azd up --no-prompt +# Or step-by-step: +azd provision --no-prompt # Create App Service, plan, and dependencies +azd deploy --no-prompt # Deploy application code + # Preview changes before deployment azd provision --preview @@ -55,18 +56,12 @@ azd down --force --purge > > Always back up important data before running `azd down`. -**Why azd is preferred:** +**Why azd is required:** - **Parallel provisioning** - Deploys in seconds, not minutes -- **Single command** - `azd up` replaces 5+ `az` commands +- **Single command** - `azd up` replaces 5+ commands - **Infrastructure as Code** - Reproducible with Bicep - **Environment management** - Easy dev/staging/prod separation -- **Use az for queries only** - `az webapp list`, `az webapp show`, etc. - -**When `az` CLI is acceptable:** -- Single-resource deployments without IaC requirements -- Quick prototyping or one-off deployments -- User explicitly requests `az` CLI -- Querying or inspecting existing resources +- **Consistent workflow** - Same commands work across all Azure services --- @@ -74,8 +69,8 @@ azd down --force --purge | Property | Value | |----------|-------| -| CLI prefix | `az webapp` | -| MCP tools | `azure__appservice` (commands: `appservice_webapp_list`, `appservice_webapp_get`, `appservice_plan_list`) | +| Deployment tool | `azd` (Azure Developer CLI) | +| MCP tools | `azure__azd` (commands: `validate_azure_yaml`, `discovery_analysis`) | | Best for | Web apps, REST APIs, managed hosting | | azd Template | `todo-csharp-sql`, `todo-nodejs-mongo` | @@ -85,22 +80,10 @@ azd down --force --purge ### Required Tools -**Azure CLI:** -```bash -# macOS -brew install azure-cli - -# Windows -winget install Microsoft.AzureCLI - -# Linux -curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash -``` - **Azure Developer CLI (azd):** ```bash # macOS -brew install azd +brew tap azure/azure-dev && brew install azd # Windows winget install Microsoft.Azd @@ -112,17 +95,15 @@ curl -fsSL https://aka.ms/install-azd.sh | bash ### Authentication ```bash -# Login to Azure -az login - -# Verify subscription -az account show --query "{name:name, id:id}" -o table +# Login to Azure with azd +azd auth login -# Set subscription if needed -az account set --subscription "" +# Verify login status +azd auth login --check-status -# Login to azd -azd auth login +# Set environment and subscription +azd env new +azd env set AZURE_SUBSCRIPTION_ID "" ``` --- @@ -130,7 +111,7 @@ azd auth login ## Pre-flight Check **Run `/azure:preflight` before deploying** to verify: -- Tools installed (az, azd) +- Tools installed (azd) - Authentication valid - Quotas sufficient - Subscription has capacity @@ -141,7 +122,7 @@ azd auth login ### MCP Tools for App Service -Use the Azure MCP server's azd tools (`azure-azd`) for validation: +Use the Azure MCP server's azd tools (`azure__azd`) for validation: | Command | Description | |---------|-------------| @@ -151,7 +132,7 @@ Use the Azure MCP server's azd tools (`azure-azd`) for validation: **Validate before deployment:** ```javascript -const validation = await azure-azd({ +const validation = await azure__azd({ command: "validate_azure_yaml", parameters: { path: "./azure.yaml" } }); @@ -233,6 +214,8 @@ output webAppUrl string = webApp.properties.defaultHostName ### Creating App Service Plans +> **Note:** Always use `azd up --no-prompt` for deployments. Define plan configuration in Bicep templates. The commands below are legacy reference only. + ```bash # Create Basic plan az appservice plan create \ @@ -279,6 +262,8 @@ az appservice plan create \ ### Create Web App +> **Note:** Always use `azd up --no-prompt` for deployments. The commands below are legacy reference only. + ```bash # Create Node.js web app az webapp create \ diff --git a/plugin/skills/azure-create-app/reference/app-type-detection.md b/plugin/skills/azure-create-app/reference/app-type-detection.md new file mode 100644 index 00000000..eb074933 --- /dev/null +++ b/plugin/skills/azure-create-app/reference/app-type-detection.md @@ -0,0 +1,68 @@ +# Application Type Detection + +Use these patterns to identify application types during discovery. + +## Node.js Applications + +**Indicator:** `package.json` exists + +| Pattern | Azure Service | +|---------|---------------| +| `next.config.js/mjs/ts` with `output: 'export'` | Static Web Apps | +| `next.config.js/mjs/ts` without export config | Container Apps (SSR) | +| `angular.json` | Static Web Apps | +| `vite.config.*` | Static Web Apps | +| `gatsby-config.js` | Static Web Apps | +| `astro.config.mjs` | Static Web Apps | +| `nest-cli.json` | Container Apps | +| express/fastify/koa/hapi dependency | Container Apps | + +## Python Applications + +**Indicator:** `requirements.txt` or `pyproject.toml` exists + +| Pattern | Azure Service | +|---------|---------------| +| `function_app.py` exists | Azure Functions | +| `azure-functions` dependency | Azure Functions | +| flask/django/fastapi dependency | Container Apps | + +## .NET Applications + +**Indicator:** `*.csproj` or `*.sln` exists + +| Pattern | Azure Service | +|---------|---------------| +| `` in csproj | Azure Functions | +| Blazor WebAssembly | Static Web Apps | +| ASP.NET Core | Container Apps | + +## Java Applications + +**Indicator:** `pom.xml` or `build.gradle` exists + +| Pattern | Azure Service | +|---------|---------------| +| `azure-functions-*` dependency | Azure Functions | +| spring-boot dependency | Container Apps | + +## Static Sites + +**Indicator:** `index.html` without `package.json` or `requirements.txt` + +→ **Static Web Apps** + +## Containerized Applications + +**Indicator:** `Dockerfile` exists + +→ **Container Apps** (or AKS if complex Kubernetes needs) + +## Multi-Service Indicators + +These patterns suggest a multi-service application: + +- Monorepo structure (`frontend/`, `backend/`, `api/`) +- `docker-compose.yml` with multiple services +- Multiple `package.json` files in subdirectories +- Database connection strings in config files diff --git a/plugin/skills/azure-create-app/reference/azure-yaml-config.md b/plugin/skills/azure-create-app/reference/azure-yaml-config.md new file mode 100644 index 00000000..0855c786 --- /dev/null +++ b/plugin/skills/azure-create-app/reference/azure-yaml-config.md @@ -0,0 +1,80 @@ +# azure.yaml Configuration + +The `azure.yaml` file defines your application's Azure deployment configuration. + +## Host Property + +The `host` property determines the Azure service: + +| Value | Azure Service | +|-------|---------------| +| `containerapp` | Azure Container Apps | +| `appservice` | Azure App Service | +| `staticwebapp` | Azure Static Web Apps | +| `function` | Azure Functions | +| `aks` | Azure Kubernetes Service | + +## Language Property + +The `language` property specifies the application runtime. + +**Valid values:** `js`, `ts`, `python`, `csharp`, `java`, `go` + +**Rules by host type:** + +| Host | Language Requirement | +|------|---------------------| +| `staticwebapp` | Do NOT specify for plain HTML sites | +| `containerapp` | Optional, used for build detection | +| `appservice` | Required for runtime selection | +| `function` | Required for runtime | + +## Example Configurations + +### Multi-Service Application + +```yaml +name: my-application +services: + web: + project: ./src/web + host: staticwebapp + dist: ./dist + api: + project: ./src/api + host: containerapp + language: python +``` + +### Single Container App + +```yaml +name: my-api +services: + api: + project: . + host: containerapp + language: ts +``` + +### Azure Functions + +```yaml +name: my-functions +services: + func: + project: . + host: function + language: python +``` + +### Static Web App with API + +```yaml +name: my-frontend +services: + web: + project: . + host: staticwebapp + dist: ./dist +``` diff --git a/plugin/skills/azure-deploy/reference/container-apps.md b/plugin/skills/azure-create-app/reference/container-apps.md similarity index 98% rename from plugin/skills/azure-deploy/reference/container-apps.md rename to plugin/skills/azure-create-app/reference/container-apps.md index d06fc632..6c7bb8ce 100644 --- a/plugin/skills/azure-deploy/reference/container-apps.md +++ b/plugin/skills/azure-create-app/reference/container-apps.md @@ -68,14 +68,6 @@ async function validatePrerequisites() { throw new Error('Docker is not installed. Install Docker Desktop from https://www.docker.com/products/docker-desktop'); } - // Check Azure CLI authentication - try { - await exec('az account show'); - checks.push({ name: 'Azure CLI', status: 'authenticated' }); - } catch (error) { - throw new Error('Not authenticated with Azure CLI. Run: az login'); - } - // Check Azure Developer CLI authentication try { await exec('azd auth login --check-status'); @@ -103,8 +95,6 @@ async function validatePrerequisites() { **Setup:** - [ ] Azure subscription created -- [ ] Azure CLI installed (`az --version`) -- [ ] Azure CLI authenticated (`az login`) - [ ] **Docker Desktop installed and running** (`docker ps`) - [ ] Azure Developer CLI (azd) installed (`azd version`) - [ ] Azure Developer CLI authenticated (`azd auth login`) @@ -163,7 +153,7 @@ az account set --subscription "" ### azd-Specific MCP Tools -Use the Azure MCP server's azd tools (`azure-azd`) for validation and guidance: +Use the Azure MCP server's azd tools (`azure__azd`) for validation and guidance: | Command | Description | |---------|-------------| @@ -597,7 +587,7 @@ azd deploy api --no-prompt **Validate azure.yaml before deployment:** ```javascript // Use MCP tool to validate azure.yaml -const validation = await azure-azd({ +const validation = await azure__azd({ command: "validate_azure_yaml", parameters: { path: "./azure.yaml" } }); diff --git a/plugin/skills/azure-create-app/reference/error-handling.md b/plugin/skills/azure-create-app/reference/error-handling.md new file mode 100644 index 00000000..da4a967e --- /dev/null +++ b/plugin/skills/azure-create-app/reference/error-handling.md @@ -0,0 +1,47 @@ +# Error Handling + +## MCP Tool Failures + +If any MCP tool call fails, call the `azure__azd` MCP tool for troubleshooting: + +```javascript +await azure__azd({ + command: "error_troubleshooting", + parameters: {} +}); +``` + +## Common Error Resolutions + +| Error | Resolution | +|-------|------------| +| "azure.yaml invalid" | Call `validate_azure_yaml` and fix reported errors | +| "Bicep compilation error" | Check module paths and parameters | +| "Service not found" | Verify service name matches `azure.yaml` configuration | +| "Docker build failed" | Check Dockerfile syntax and base image availability | +| "Authentication failed" | Run `az login` or check service principal credentials | + +## Validation Errors + +### azure.yaml Schema Errors + +Common issues: +- Missing required `name` property +- Invalid `host` value +- Missing `project` path +- Incorrect `dist` path for static web apps + +### Bicep Compilation Errors + +Common issues: +- Missing module files +- Parameter type mismatches +- Undefined variables +- Invalid resource API versions + +## Debugging Tips + +1. **Check azure.yaml syntax** - Use `validate_azure_yaml` command +2. **Verify file paths** - Ensure all referenced paths exist +3. **Review Bicep templates** - Check for compilation errors +4. **Test locally first** - Run `azd package` before `azd provision` diff --git a/plugin/skills/azure-deploy/reference/functions.md b/plugin/skills/azure-create-app/reference/functions.md similarity index 73% rename from plugin/skills/azure-deploy/reference/functions.md rename to plugin/skills/azure-create-app/reference/functions.md index 5f678fdf..1a8c5f7a 100644 --- a/plugin/skills/azure-deploy/reference/functions.md +++ b/plugin/skills/azure-create-app/reference/functions.md @@ -1,6 +1,6 @@ # Azure Functions Deployment Guide -Complete reference for deploying serverless functions to Azure Function Apps using Azure CLI and Azure Functions Core Tools. +Complete reference for deploying serverless functions to Azure Function Apps using `azd` (Azure Developer CLI) and Azure Functions Core Tools. --- @@ -25,11 +25,46 @@ Azure Functions is a serverless compute service that enables you to run event-dr **Deployment Workflow:** ``` -Init → Develop → Test Locally → Create Resources → Deploy → Monitor +Init → Develop → Test Locally → azd up → Monitor ``` --- +## Always Use azd for Deployments + +> **Always use `azd` (Azure Developer CLI) for Azure provisioning and Functions deployments.** +> The `azd` tool provides a complete, reproducible deployment workflow for all Functions scenarios. + +```bash +# Deploy everything in one command +azd up --no-prompt + +# Or step-by-step: +azd init # Create azure.yaml and infra/ +azd provision --no-prompt # Create Function App, Storage, and dependencies +azd deploy --no-prompt # Deploy function code + +# Preview changes before deployment +azd provision --preview + +# Clean up test environments +azd down --force --purge +``` + +> ⚠️ **CRITICAL: `azd down` Data Loss Warning** +> +> `azd down` **permanently deletes ALL resources** including Function Apps, Storage accounts, and Key Vaults. +> Always back up important data before running `azd down`. + +**Why azd is required:** +- **Parallel provisioning** - Deploys in seconds, not minutes +- **Single command** - `azd up` replaces 5+ commands +- **Infrastructure as Code** - Reproducible with Bicep +- **Environment management** - Easy dev/staging/prod separation +- **Consistent workflow** - Same commands work across all Azure services + +--- + ## Prerequisites and Validation ### Pattern 0: Prerequisites Validation @@ -40,12 +75,12 @@ Init → Develop → Test Locally → Create Resources → Deploy → Monitor async function validatePrerequisites() { const checks = []; - // Check Azure CLI authentication + // Check azd authentication try { - await exec('az account show'); - checks.push({ name: 'Azure CLI', status: 'authenticated' }); + await exec('azd auth login --check-status'); + checks.push({ name: 'Azure Developer CLI', status: 'authenticated' }); } catch (error) { - throw new Error('Not authenticated with Azure CLI. Run: az login'); + throw new Error('Not authenticated with Azure Developer CLI. Run: azd auth login'); } // Check Azure Functions Core Tools - install if not present @@ -95,8 +130,8 @@ sudo apt-get install azure-functions-core-tools-4 **Setup:** - [ ] Azure subscription created -- [ ] Azure CLI installed (`az --version`) -- [ ] Azure CLI authenticated (`az login`) +- [ ] Azure Developer CLI installed (`azd version`) +- [ ] Azure Developer CLI authenticated (`azd auth login`) - [ ] Azure Functions Core Tools installed (`func --version`) - [ ] Node.js/Python/.NET installed (based on runtime) @@ -248,96 +283,108 @@ app.storageBlob('BlobTrigger', { ## Pattern 3: Create Azure Resources -Create the required Azure resources for deployment. +### Using azd (Required) ```bash -# Set variables -RESOURCE_GROUP="myResourceGroup" -LOCATION="eastus" -STORAGE_ACCOUNT="mystorageaccount$(date +%s)" -FUNCTION_APP="myFunctionApp$(date +%s)" - -# Create resource group -az group create --name $RESOURCE_GROUP --location $LOCATION - -# Create storage account (required for Function Apps) -az storage account create \ - --name $STORAGE_ACCOUNT \ - --resource-group $RESOURCE_GROUP \ - --location $LOCATION \ - --sku Standard_LRS - -# Create Function App (Consumption Plan - pay per execution) -az functionapp create \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --storage-account $STORAGE_ACCOUNT \ - --consumption-plan-location $LOCATION \ - --runtime node \ - --runtime-version 20 \ - --functions-version 4 \ - --os-type Linux +# Initialize project with azure.yaml +azd init + +# Provision infrastructure and deploy +azd up --no-prompt + +# Or step-by-step: +azd provision --no-prompt # Create Function App, Storage, App Insights +azd deploy --no-prompt # Deploy function code ``` ### Hosting Plans +Configure hosting plan in your Bicep templates under `infra/`: + | Plan | Use Case | Scaling | Pricing | |------|----------|---------|---------| | **Consumption** | Event-driven, variable load | Auto-scale, scale to zero | Pay per execution | | **Premium** | Enhanced performance, VNET | Pre-warmed instances | Fixed hourly rate | | **Dedicated (App Service)** | Predictable workloads | Manual/auto-scale | App Service Plan pricing | -#### Create with Premium Plan +**Bicep example for Consumption plan (default):** +```bicep +resource hostingPlan 'Microsoft.Web/serverfarms@2023-12-01' = { + name: hostingPlanName + location: location + sku: { + name: 'Y1' + tier: 'Dynamic' + } + properties: {} +} -```bash -# Create Premium plan -az functionapp plan create \ - --name myPremiumPlan \ - --resource-group $RESOURCE_GROUP \ - --location $LOCATION \ - --sku EP1 \ - --is-linux - -# Create Function App on Premium plan -az functionapp create \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --storage-account $STORAGE_ACCOUNT \ - --plan myPremiumPlan \ - --os-type Linux \ - --runtime node \ - --runtime-version 20 \ - --functions-version 4 -``` - -#### Create with Dedicated Plan +resource functionApp 'Microsoft.Web/sites@2023-12-01' = { + name: functionAppName + location: location + kind: 'functionapp,linux' + properties: { + serverFarmId: hostingPlan.id + siteConfig: { + linuxFxVersion: 'NODE|20' + appSettings: [ + { name: 'FUNCTIONS_WORKER_RUNTIME', value: 'node' } + { name: 'FUNCTIONS_EXTENSION_VERSION', value: '~4' } + { name: 'AzureWebJobsStorage', value: storageConnectionString } + ] + } + } +} +``` -```bash -# Create App Service plan -az appservice plan create \ - --name myAppServicePlan \ - --resource-group $RESOURCE_GROUP \ - --location $LOCATION \ - --sku B1 \ - --is-linux - -# Create Function App on App Service plan -az functionapp create \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --storage-account $STORAGE_ACCOUNT \ - --plan myAppServicePlan \ - --os-type Linux \ - --runtime node \ - --runtime-version 20 \ - --functions-version 4 +**Bicep example for Premium plan:** +```bicep +resource hostingPlan 'Microsoft.Web/serverfarms@2023-12-01' = { + name: 'myPremiumPlan' + location: location + sku: { + name: 'EP1' + tier: 'ElasticPremium' + } + kind: 'elastic' + properties: { + reserved: true // Linux + } +} +``` + +**Bicep example for Dedicated plan:** +```bicep +resource hostingPlan 'Microsoft.Web/serverfarms@2023-12-01' = { + name: 'myAppServicePlan' + location: location + sku: { + name: 'B1' + tier: 'Basic' + } + properties: { + reserved: true // Linux + } +} ``` --- ## Pattern 4: Deploy Functions -Deploy functions to Azure using Azure Functions Core Tools. +Deploy functions to Azure using azd or Azure Functions Core Tools. + +### Using azd (Recommended) + +```bash +# Deploy with azd +azd deploy --no-prompt + +# Deploy to specific environment +azd deploy --environment staging --no-prompt +``` + +### Using func CLI ```bash # Deploy to Azure (from project root) @@ -372,55 +419,47 @@ func azure functionapp publish $FUNCTION_APP --publish-settings-only func azure functionapp publish $FUNCTION_APP --publish-local-settings --overwrite-settings ``` -### Alternative Deployment Methods - -**Azure CLI ZIP Deploy:** -```bash -# Zip the function app -zip -r function-app.zip . - -# Deploy zip file -az functionapp deployment source config-zip \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --src function-app.zip -``` - --- ## Pattern 5: Configuration Management -Manage application settings and connection strings. +Manage application settings using azd environment variables and Bicep. + +### Using azd (Recommended) ```bash -# Set application setting -az functionapp config appsettings set \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --settings "MySetting=MyValue" "AnotherSetting=AnotherValue" - -# Set connection string -az functionapp config connection-string set \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --connection-string-type SQLAzure \ - --settings "MyConnection=Server=tcp:..." - -# List settings -az functionapp config appsettings list \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP - -# Delete setting -az functionapp config appsettings delete \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --setting-names "MySetting" +# Set environment variables with azd +azd env set MY_SETTING "MyValue" +azd env set ANOTHER_SETTING "AnotherValue" + +# Deploy with updated settings +azd deploy --no-prompt # Upload local.settings.json to Azure func azure functionapp publish $FUNCTION_APP --publish-local-settings ``` +### Bicep Configuration + +Define app settings in your Bicep template: + +```bicep +resource functionApp 'Microsoft.Web/sites@2023-12-01' = { + name: functionAppName + location: location + kind: 'functionapp,linux' + properties: { + siteConfig: { + appSettings: [ + { name: 'FUNCTIONS_WORKER_RUNTIME', value: 'node' } + { name: 'MY_SETTING', value: mySetting } + { name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', value: appInsights.properties.ConnectionString } + ] + } + } +} +``` + ### local.settings.json ```json @@ -449,48 +488,42 @@ func azure functionapp publish $FUNCTION_APP --publish-local-settings View function execution logs and diagnostics. +### Using azd + +```bash +# View logs from deployed functions +azd monitor --logs + +# Open Azure Portal to view metrics +azd monitor --overview +``` + +### Using func CLI + ```bash # Stream live logs func azure functionapp logstream $FUNCTION_APP -# Stream logs for specific function +# Stream logs in browser func azure functionapp logstream $FUNCTION_APP --browser - -# View deployment logs -az functionapp log deployment list \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP - -# Show deployment log -az functionapp log deployment show \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --deployment-id ``` ### Application Insights Integration -**Enable Application Insights (recommended):** +Application Insights is automatically configured when using azd. Define it in Bicep: -```bash -# Create Application Insights -az monitor app-insights component create \ - --app $FUNCTION_APP-insights \ - --location $LOCATION \ - --resource-group $RESOURCE_GROUP \ - --application-type web - -# Get connection string (use connection string, not instrumentation key) -APPINSIGHTS_CONNECTION_STRING=$(az monitor app-insights component show \ - --app $FUNCTION_APP-insights \ - --resource-group $RESOURCE_GROUP \ - --query connectionString -o tsv) - -# Link App Insights to Function App -az functionapp config appsettings set \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --settings "APPLICATIONINSIGHTS_CONNECTION_STRING=$APPINSIGHTS_CONNECTION_STRING" +```bicep +resource appInsights 'Microsoft.Insights/components@2020-02-02' = { + name: '${functionAppName}-insights' + location: location + kind: 'web' + properties: { + Application_Type: 'web' + } +} + +// Link to Function App via app settings in the functionApp resource +// { name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', value: appInsights.properties.ConnectionString } ``` **Query Application Insights:** @@ -525,41 +558,40 @@ requests ## Pattern 7: Deployment Slots (Premium/Dedicated Plans) -Use deployment slots for zero-downtime deployments. +Use deployment slots for zero-downtime deployments. Configure slots in Bicep and deploy with azd. -```bash -# Create staging slot -az functionapp deployment slot create \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --slot staging +### Bicep Configuration -# Deploy to staging slot -func azure functionapp publish $FUNCTION_APP --slot staging +```bicep +resource stagingSlot 'Microsoft.Web/sites/slots@2023-12-01' = { + parent: functionApp + name: 'staging' + location: location + kind: 'functionapp,linux' + properties: { + serverFarmId: hostingPlan.id + } +} +``` -# Swap slots (zero downtime) -az functionapp deployment slot swap \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --slot staging \ - --target-slot production +### Deploy to Slots -# Swap with preview -az functionapp deployment slot swap \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --slot staging \ - --target-slot production \ - --action preview +Deployment slots are Azure resources, not azd environments. Use the Azure Functions Core Tools CLI to deploy to slots: + +```bash +# Deploy to staging slot +func azure functionapp publish --slot staging -# Complete swap +# After testing, swap staging to production via Azure CLI az functionapp deployment slot swap \ - --name $FUNCTION_APP \ - --resource-group $RESOURCE_GROUP \ - --slot staging \ - --action swap + --name \ + --resource-group \ + --slot staging \ + --target-slot production ``` +> **Note:** `azd deploy --environment` manages separate azd environments (different resource sets), not deployment slots within the same Function App. + --- ## Pattern 8: CI/CD with GitHub Actions @@ -612,15 +644,18 @@ jobs: package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} ``` -**Create Azure credentials secret:** +**Configure GitHub Actions with azd:** + +Use `azd pipeline config` to set up GitHub Actions with proper credentials: + ```bash -az ad sp create-for-rbac --name "github-actions-sp" \ - --role contributor \ - --scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group} \ - --sdk-auth +# Configure CI/CD pipeline +azd pipeline config ``` -Add the output as `AZURE_CREDENTIALS` secret in GitHub repository settings. +This command automatically creates the necessary GitHub Actions workflow and the required secrets (including `AZURE_CREDENTIALS`) for you. No additional manual secret configuration is required when you use `azd pipeline config`. + +> **Note:** If you choose to configure GitHub Actions manually instead of using `azd pipeline config`, create a service principal with `az ad sp create-for-rbac` and add its JSON output as an `AZURE_CREDENTIALS` secret in your GitHub repository settings. --- @@ -751,20 +786,11 @@ func start --verbose # Stream live logs from Azure func azure functionapp logstream $FUNCTION_APP -# Get function app details -az functionapp show --name $FUNCTION_APP --resource-group $RESOURCE_GROUP - -# View configuration -az functionapp config show --name $FUNCTION_APP --resource-group $RESOURCE_GROUP - -# View app settings -az functionapp config appsettings list --name $FUNCTION_APP --resource-group $RESOURCE_GROUP - -# Check function app state -az functionapp show --name $FUNCTION_APP --resource-group $RESOURCE_GROUP --query "state" +# View logs with azd +azd monitor --logs -# Restart function app -az functionapp restart --name $FUNCTION_APP --resource-group $RESOURCE_GROUP +# Open Azure Portal for function app +azd monitor --overview ``` --- diff --git a/plugin/skills/azure-create-app/reference/service-selection.md b/plugin/skills/azure-create-app/reference/service-selection.md new file mode 100644 index 00000000..20c3ec7b --- /dev/null +++ b/plugin/skills/azure-create-app/reference/service-selection.md @@ -0,0 +1,47 @@ +# Service Selection Rules + +Use these rules when mapping application components to Azure services. + +## Static Web Apps + +**Use when:** +- Application is a static frontend (React, Vue, Angular, Svelte) +- Application is a Jamstack site (Gatsby, Hugo, Astro) +- Application needs global CDN distribution +- Application has optional serverless API + +**Requirements:** +- Built files must be in a `dist` folder +- Reference this in `azure.yaml` using the `dist` property +- For plain HTML sites, create a `dist/` folder and copy deployable files there + +## Container Apps + +**Use when:** +- Application is a microservice or API +- Application is a full-stack web application +- Application needs background workers or queue processors +- Application needs scheduled jobs (use Container Apps Jobs) +- Application is already containerized with Docker + +## Azure Functions + +**Use when:** +- Application is event-driven serverless +- Application needs HTTP APIs with per-request billing +- Application needs timer-triggered jobs +- Application uses queue/blob/event triggers + +## App Service + +**Use when:** +- Application is a traditional web application +- Container Apps features are not needed +- Migrating existing App Service application + +## Azure Kubernetes Service (AKS) + +**Use when:** +- Application has complex Kubernetes requirements +- Application needs custom operators or CRDs +- Team has existing Kubernetes expertise diff --git a/plugin/skills/azure-deploy/reference/static-web-apps.md b/plugin/skills/azure-create-app/reference/static-web-apps.md similarity index 95% rename from plugin/skills/azure-deploy/reference/static-web-apps.md rename to plugin/skills/azure-create-app/reference/static-web-apps.md index 0ebd637a..e3a6befe 100644 --- a/plugin/skills/azure-deploy/reference/static-web-apps.md +++ b/plugin/skills/azure-create-app/reference/static-web-apps.md @@ -21,12 +21,24 @@ Azure Static Web Apps (SWA) provides: ## Prerequisites ### Required Tools -- **SWA CLI** - Static Web Apps command-line tool -- **Azure CLI** - For resource management +- **Azure Developer CLI (azd)** - For resource provisioning and deployment +- **SWA CLI** - Static Web Apps command-line tool (optional, for local development) - **Node.js** - For SWA CLI and managed Functions APIs ### Installation +**Azure Developer CLI (azd):** +```bash +# macOS +brew tap azure/azure-dev && brew install azd + +# Windows +winget install Microsoft.Azd + +# Linux +curl -fsSL https://aka.ms/install-azd.sh | bash +``` + **SWA CLI - Option 1: Install locally in project (recommended)** ```bash npm install -D @azure/static-web-apps-cli @@ -50,28 +62,24 @@ npx @azure/static-web-apps-cli --version --- -## Quick Start +## Quick Start with azd + +> **Always use `azd` for Static Web Apps deployments.** The `azd` tool provides a complete, reproducible workflow. ```bash -# 1. Create resource group -az group create --name myswa-rg --location centralus +# Deploy everything in one command +azd up --no-prompt -# 2. Create Static Web App (limited regions: centralus, eastus2, westus2, westeurope, eastasia) -az staticwebapp create \ - --name myswa \ - --resource-group myswa-rg \ - --location centralus \ - --sku Free +# Or step-by-step: +azd init # Create azure.yaml and infra/ +azd provision --no-prompt # Create Static Web App resource +azd deploy --no-prompt # Deploy built content -# 3. Get deployment token -TOKEN=$(az staticwebapp secrets list \ - --name myswa \ - --resource-group myswa-rg \ - --query "properties.apiKey" -o tsv) +# Preview changes before deployment +azd provision --preview -# 4. Build and deploy -npm run build -npx swa deploy ./dist --deployment-token "$TOKEN" --env production +# Clean up test environments +azd down --force --purge ``` > ⚠️ **CRITICAL: SWA CLI Directory Rule** @@ -93,13 +101,18 @@ npx swa deploy ./dist --deployment-token "$TOKEN" --env production | **Free** | $0/month | 2 custom domains, 100GB bandwidth/month, community support | | **Standard** | ~$9/month | 5 custom domains, unlimited bandwidth, password protection, custom auth providers, SLA | -```bash -# Create with Standard SKU -az staticwebapp create \ - --name myapp \ - --resource-group myapp-rg \ - --location centralus \ - --sku Standard +To use Standard SKU with azd, set the SKU in your Bicep template (`infra/main.bicep`): + +```bicep +resource staticWebApp 'Microsoft.Web/staticSites@2022-09-01' = { + name: name + location: location + sku: { + name: 'Standard' + tier: 'Standard' + } + // ... +} ``` --- diff --git a/plugin/skills/azure-deploy/SKILL.md b/plugin/skills/azure-deploy/SKILL.md index 273f82d5..ccf71726 100644 --- a/plugin/skills/azure-deploy/SKILL.md +++ b/plugin/skills/azure-deploy/SKILL.md @@ -1,815 +1,176 @@ --- name: azure-deploy -description: Deploy applications to Azure App Service, Azure Functions, and Static Web Apps. USE THIS SKILL when users want to deploy, publish, host, or run their application on Azure. This skill detects application type (React, Vue, Angular, Next.js, Python, .NET, Java, etc.), recommends the optimal Azure service, provides local preview capabilities, and guides deployment. Trigger phrases include "deploy to Azure", "host on Azure", "publish to Azure", "run on Azure", "get this running in the cloud", "deploy my app", "Azure deployment", "set up Azure hosting", "deploy to App Service", "deploy to Functions", "deploy to Static Web Apps", "preview locally", "test before deploying", "what Azure service should I use", "help me deploy", etc. Also handles multi-service deployments with Azure Developer CLI (azd) and Infrastructure as Code when complexity is detected. +description: Deploy applications to Azure using Azure Developer CLI (azd). USE THIS SKILL when users want to deploy, publish, host, or run their application on Azure. Trigger phrases include "deploy to Azure", "host on Azure", "publish to Azure", "run on Azure", "deploy my app", "azd up", etc. --- -## Preferred: Use azd for Deployments - -> **Prefer `azd` (Azure Developer CLI) over raw `az` CLI for deployments.** -> Use `az` CLI for resource queries, simple single-resource deployments, or when explicitly requested. - -**Why azd is preferred:** -- **Faster** - provisions resources in parallel -- **Automatic ACR integration** - no manual credential setup -- **Single command** - `azd up` does everything -- **Infrastructure as Code** - reproducible deployments with Bicep -- **Environment management** - easy dev/staging/prod separation - -**When `az` CLI is acceptable:** -- Single-resource deployments without IaC requirements -- Quick prototyping or one-off deployments -- User explicitly requests `az` CLI -- Querying or inspecting existing resources - -> ⚠️ **IMPORTANT: For automation and agent scenarios**, always use the `--no-prompt` flag with azd commands to prevent interactive prompts from blocking execution: -> ```bash -> azd up --no-prompt -> azd provision --no-prompt -> azd deploy --no-prompt -> ``` - -## MCP Tools for azd Workflows - -Use the Azure MCP server's azd tools (`azure-azd`) for validation and guidance: - -| Command | Description | -|---------|-------------| -| `validate_azure_yaml` | **Validates azure.yaml against official JSON schema** - Use before deployment | -| `discovery_analysis` | Analyze application components for AZD migration | -| `architecture_planning` | Select Azure services for discovered components | -| `azure_yaml_generation` | Instructions for generating azure.yaml | -| `docker_generation` | Generate Dockerfiles for Container Apps/AKS | -| `infrastructure_generation` | Generate Bicep templates | -| `iac_generation_rules` | Get Bicep compliance rules and best practices | -| `project_validation` | Comprehensive validation before deployment | -| `error_troubleshooting` | Diagnose and troubleshoot azd errors | - -**Always validate azure.yaml before deployment:** -```javascript -// Validate azure.yaml using MCP tool -const validation = await azure-azd({ - command: "validate_azure_yaml", - parameters: { path: "./azure.yaml" } -}); -``` - -### Additional MCP Tools - -For deployment planning and logs, use `azure__deploy`: - -| Tool | Command | Description | -|------|---------|-------------| -| `azure__deploy` | `deploy_plan_get` | Generate a deployment plan for Azure infrastructure and applications | -| `azure__deploy` | `deploy_iac_rules_get` | Get IaC (Bicep/Terraform) guidelines | -| `azure__deploy` | `deploy_app_logs_get` | Fetch logs from deployed apps (Container Apps, App Service, Functions) | -| `azure__deploy` | `deploy_pipeline_guidance_get` | Get CI/CD pipeline guidance | -| `azure__deploy` | `deploy_architecture_diagram_generate` | Generate Azure service architecture diagrams | - -## Capabilities - -Deploy applications to Azure with intelligent service selection, local preview, and guided deployment workflows. - ---- - -## Quick Start Decision Tree - -``` -User wants to deploy → Run detection workflow below -``` - ---- - -## Phase 1: Application Detection - -**ALWAYS start by scanning the user's project to detect the application type.** - -### Step 1.1: Check for Existing Azure Configuration - -Look for these files first (HIGH confidence signals): - -| File Found | Recommendation | Action | -|------------|----------------|--------| -| `azure.yaml` | Already configured for azd | **Validate first**, then use `azd up` to deploy | -| `function.json` or `host.json` | Azure Functions project | **See [Azure Functions Guide](./reference/functions.md)** | -| `staticwebapp.config.json` or `swa-cli.config.json` | Static Web Apps project | **See [Static Web Apps Guide](./reference/static-web-apps.md)** | - -**When `azure.yaml` is found, validate before deployment:** -```javascript -// Validate azure.yaml using MCP tool before proceeding -const validation = await azure-azd({ - command: "validate_azure_yaml", - parameters: { path: "./azure.yaml" } -}); - -if (validation.errors && validation.errors.length > 0) { - // Fix validation errors before deployment - console.error("azure.yaml validation failed:", validation.errors); -} else { - // Proceed with azd up -} -``` - -If found and valid, route to the appropriate specialized skill. - -> 💡 **When to use Static Web Apps:** -> - Project has `staticwebapp.config.json` or `swa-cli.config.json` -> - User wants to deploy static frontends (React, Vue, Angular, etc.) to Azure -> - User needs local development emulation with SWA CLI -> - User wants to add Azure Functions APIs to their static site -> - User mentions Static Web Apps or SWA CLI -> -> **📖 See [Static Web Apps Deployment Guide](./reference/static-web-apps.md)** for specialized guidance on SWA CLI configuration, local emulation, GitHub Actions workflows, and database connections. - -**Check for containerization signals:** - -| File/Indicator Found | Recommendation | Action | -|---------------------|----------------|--------| -| `Dockerfile` | Containerized application | **See [Container Apps Guide](./reference/container-apps.md)** for deployment | -| `docker-compose.yml` | Multi-container application | **See [Container Apps Guide](./reference/container-apps.md)** for deployment | -| User mentions "container", "Docker", "scheduled task", "cron job", "batch processing" | Container-based deployment | **See [Container Apps Guide](./reference/container-apps.md)** | - -> 💡 **When to use Container Apps:** -> - Application is already containerized (has Dockerfile) -> - User wants to deploy multiple containers together -> - User needs scheduled tasks, cron jobs, or event-driven batch processing -> - User mentions Container Apps or wants serverless containers -> -> **📖 See [Container Apps Deployment Guide](./reference/container-apps.md)** for specialized guidance on Docker validation, ACR integration, Container Apps Jobs, and multi-container orchestration. - -### Step 1.2: Detect Application Framework - -Scan for configuration files and dependencies: - -**Node.js / JavaScript / TypeScript:** -``` -package.json exists → -├── next.config.js/mjs/ts → Next.js -│ ├── Has `output: 'export'` → Static Web Apps (SSG) -│ └── Has API routes or no export config → App Service (SSR) -├── nuxt.config.ts/js → Nuxt -│ ├── Has `ssr: false` or `target: 'static'` → Static Web Apps -│ └── Otherwise → App Service (SSR) -├── angular.json → Angular → Static Web Apps -│ └── **See [Static Web Apps Guide](./reference/static-web-apps.md)** -├── vite.config.* → Vite-based (React/Vue/Svelte) → Static Web Apps -│ └── **See [Static Web Apps Guide](./reference/static-web-apps.md)** -├── gatsby-config.js → Gatsby → Static Web Apps -│ └── **See [Static Web Apps Guide](./reference/static-web-apps.md)** -├── astro.config.mjs → Astro → Static Web Apps -│ └── **See [Static Web Apps Guide](./reference/static-web-apps.md)** -├── nest-cli.json → NestJS → App Service -├── Has express/fastify/koa/hapi dependency → App Service -└── No framework, just static build → Static Web Apps -``` - -**Python:** -``` -requirements.txt or pyproject.toml exists → -├── function_app.py exists → Azure Functions (v2 programming model) -│ └── **See [Azure Functions Guide](./reference/functions.md)** -├── Has flask dependency → App Service -├── Has django dependency → App Service -├── Has fastapi dependency → App Service -└── Has azure-functions dependency → Azure Functions - └── **See [Azure Functions Guide](./reference/functions.md)** -``` - -> 💡 **When to use Azure Functions:** -> - Project has `host.json`, `local.settings.json`, or `function_app.py` -> - User wants serverless APIs, event-driven functions, or timer-triggered jobs -> - User mentions Azure Functions, triggers, bindings, or webhooks -> -> **📖 See [Azure Functions Deployment Guide](./reference/functions.md)** for specialized guidance on function initialization, trigger configuration, deployment slots, and function-specific troubleshooting. - -**.NET:** -``` -*.csproj or *.sln exists → -├── in csproj → Azure Functions -│ └── **See [Azure Functions Guide](./reference/functions.md)** -├── Blazor WebAssembly project → Static Web Apps -├── ASP.NET Core web app → App Service -└── .NET API project → App Service -``` - -**Java:** -``` -pom.xml or build.gradle exists → -├── Has azure-functions-* dependency → Azure Functions -│ └── **See [Azure Functions Guide](./reference/functions.md)** -├── Has spring-boot dependency → App Service -└── Standard web app → App Service -``` - -**Static Only:** -``` -index.html exists + no package.json/requirements.txt → -└── Pure static site → Static Web Apps - └── **See [Static Web Apps Guide](./reference/static-web-apps.md)** -``` - -### Step 1.3: Detect Multi-Service Architecture - -Check for complexity indicators that suggest azd + IaC: - -``` -Multi-service triggers: -├── Monorepo structure (frontend/, backend/, api/, packages/, apps/) -├── docker-compose.yml with multiple services -├── Multiple package.json in different subdirectories -├── Database references in config (connection strings, .env files) -├── References to Redis, Service Bus, Event Hubs, Storage queues -├── User mentions "multiple environments", "staging", "production" -└── More than one deployable component detected -``` - -**If multi-service detected → Recommend azd + Infrastructure as Code** -See [Multi-Service Deployment Guide](./reference/multi-service.md) +# Azure Deployment Skill -### Step 1.4: Confidence Assessment - -After detection, assess confidence: - -| Confidence | Criteria | Action | -|------------|----------|--------| -| **HIGH** | Azure config file found (azure.yaml, function.json, staticwebapp.config.json) | Proceed with detected service | -| **MEDIUM** | Framework detected from dependencies | Explain recommendation, ask for confirmation | -| **LOW** | Ambiguous or no clear signals | Ask clarifying questions | - -**Clarifying questions for LOW confidence:** -1. "What type of application is this? (static website, API, full-stack, serverless functions, containerized app)" -2. "Is your application already containerized with Docker?" -3. "Does your app need server-side rendering or is it purely client-side?" -4. "Do you need scheduled tasks, cron jobs, or event-driven processing?" -5. "Will you need a database, caching, or other Azure services?" +Deploy applications to Azure using Azure Developer CLI (azd). --- -## Phase 2: Local Preview (No Azure Auth Required) +## Execution Flow -Before deploying, help users test locally. +### Step 1: Check for azure.yaml -### Static Web Apps - Local Preview -```bash -# Install SWA CLI (one-time) -npm install -g @azure/static-web-apps-cli +Check if `azure.yaml` exists in the project root. -# Start local emulator -swa start +**If `azure.yaml` does NOT exist:** +- Inform user: "No azure.yaml found. Use the azure-create-app skill to prepare your application for Azure deployment." +- Stop execution -# Or with specific paths -swa start ./dist --api-location ./api +**If `azure.yaml` exists:** +- Proceed to Step 2 -# With a dev server proxy -swa start http://localhost:3000 --api-location ./api -``` +### Step 2: Check Environment -### Azure Functions - Local Preview +Run: ```bash -# Install Azure Functions Core Tools (one-time) -npm install -g azure-functions-core-tools@4 - -# Start local Functions runtime -func start - -# With specific port -func start --port 7071 +azd env list ``` -### App Service Apps - Local Preview -Use the framework's built-in dev server: - +**If no environment exists:** +- Ask the user: "What name would you like for your Azure environment? (e.g., dev, staging, prod)" +- Create the environment with the user-provided name: ```bash -# Node.js -npm run dev -# or -npm start - -# Python Flask -flask run - -# Python FastAPI -uvicorn main:app --reload - -# .NET -dotnet run - -# Java Spring Boot -./mvnw spring-boot:run +azd env new ``` -See [Local Preview Guide](./reference/local-preview.md) for detailed setup instructions. - ---- - -## Phase 3: Prerequisites & Dependency Management +**If environment exists:** +- Proceed to Step 3 -**ALWAYS check and install missing dependencies before proceeding.** +### Step 3: Check Subscription Configuration -### 3.1 Azure Authentication (Auto-Login) - -**Check login status and automatically login if needed:** +First, check for global defaults: ```bash -# Check if logged in, auto-login if not -if ! az account show &>/dev/null; then - echo "Not logged in to Azure. Starting login..." - az login -fi - -# Verify and show current subscription -az account show --query "{name:name, id:id}" -o table -``` - -If the user has multiple subscriptions, help them select the correct one: -```bash -# List all subscriptions -az account list --query "[].{Name:name, ID:id, Default:isDefault}" -o table - -# Set subscription -az account set --subscription "" +azd config get defaults ``` -### 3.2 Dependency Detection & Auto-Install - -Run this check first and install any missing tools: - -```bash -# Check all dependencies at once -check_deps() { - local missing=() - command -v az &>/dev/null || missing+=("azure-cli") - command -v func &>/dev/null || missing+=("azure-functions-core-tools") - command -v swa &>/dev/null || missing+=("@azure/static-web-apps-cli") - command -v azd &>/dev/null || missing+=("azd") - echo "${missing[@]}" +This may return defaults like: +```json +{ + "subscription": "", + "location": "" } ``` -### 3.3 Install Missing Tools +Store these default values if present. -**Azure CLI** (required for all deployments): +Next, check environment-specific values: ```bash -# macOS -brew install azure-cli - -# Windows (PowerShell) -winget install Microsoft.AzureCLI - -# Linux (Ubuntu/Debian) -curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash +azd env get-values ``` -Multi-service triggers: -├── Monorepo structure (frontend/, backend/, api/, packages/, apps/) -├── docker-compose.yml with multiple services -├── Multiple package.json in different subdirectories -├── Database references in config (connection strings, .env files) -├── References to Redis, Service Bus, Event Hubs, Storage queues -├── User mentions "multiple environments", "staging", "production" -└── More than one deployable component detected -``` - -**If multi-service detected → Recommend azd + Infrastructure as Code** -See [Multi-Service Deployment Guide](./reference/multi-service.md) - -### Step 1.4: Confidence Assessment -After detection, assess confidence: +Check if `AZURE_SUBSCRIPTION_ID` is set in the output. -| Confidence | Criteria | Action | -|------------|----------|--------| -| **HIGH** | Azure config file found (azure.yaml, function.json, staticwebapp.config.json) | Proceed with detected service | -| **MEDIUM** | Framework detected from dependencies | Explain recommendation, ask for confirmation | -| **LOW** | Ambiguous or no clear signals | Ask clarifying questions | +**If `AZURE_SUBSCRIPTION_ID` is NOT set:** -**Clarifying questions for LOW confidence:** -1. "What type of application is this? (static website, API, full-stack, serverless functions, containerized app)" -2. "Is your application already containerized with Docker?" -3. "Does your app need server-side rendering or is it purely client-side?" -4. "Do you need scheduled tasks, cron jobs, or event-driven processing?" -5. "Will you need a database, caching, or other Azure services?" - ---- - -## Specialized Deployment Skills - -**Azure Functions Core Tools** (for Functions projects): -```bash -# npm (all platforms) -npm install -g azure-functions-core-tools@4 - -# macOS -brew tap azure/functions && brew install azure-functions-core-tools@4 - -# Windows -winget install Microsoft.AzureFunctionsCoreTools -``` - -**Static Web Apps CLI** (for SWA projects): -```bash -npm install -g @azure/static-web-apps-cli -``` - -**Azure Developer CLI** (for multi-service/IaC): -```bash -# macOS -brew install azd - -# Windows -winget install Microsoft.Azd - -# Linux -curl -fsSL https://aka.ms/install-azd.sh | bash +1. Call the `azure__subscription_list` MCP tool to get available subscriptions: +```json +{ + "command": "subscription_list", + "parameters": {} +} ``` -### 3.4 Project Dependencies - -Detect and install project-level dependencies: +2. Present the list of subscriptions to the user. If a default subscription was found in `azd config get defaults`, include it in the prompt: + - With default: "Which Azure subscription would you like to use? (default from azd config: ``)" + - Without default: "Which Azure subscription would you like to use for this deployment?" +3. Set the subscription with the user-selected value (or use default if user accepts): ```bash -# Node.js - install if node_modules missing -[ -f "package.json" ] && [ ! -d "node_modules" ] && npm install - -# Python - create venv and install if missing -[ -f "requirements.txt" ] && [ ! -d ".venv" ] && python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt - -# .NET - restore packages -[ -f "*.csproj" ] && dotnet restore - -# Java - install dependencies -[ -f "pom.xml" ] && mvn dependency:resolve +azd env set AZURE_SUBSCRIPTION_ID ``` ---- +**If `AZURE_SUBSCRIPTION_ID` is set:** +- Proceed to Step 4 -## Phase 4: Single-Service Deployment (Azure CLI) +### Step 4: Check Location Configuration -### 4.1 Static Web Apps Deployment +Check if `AZURE_LOCATION` is set in the `azd env get-values` output from Step 3. -> 💡 **For advanced Static Web Apps scenarios**, see the **[Static Web Apps Deployment Guide](./reference/static-web-apps.md)** which provides: -> - SWA CLI configuration and local emulation -> - Framework-specific setup guidance -> - Azure Functions API integration -> - GitHub Actions workflow automation -> - Database connections setup -> - Advanced routing and authentication configuration +**If `AZURE_LOCATION` is NOT set:** -**Create resource and deploy:** +1. Get the list of available Azure regions: ```bash -# Create resource group (if needed) -az group create --name --location - -# Create Static Web App -az staticwebapp create \ - --name \ - --resource-group \ - --location \ - --sku Free - -# Get deployment token -az staticwebapp secrets list \ - --name \ - --resource-group \ - --query "properties.apiKey" -o tsv - -# Deploy with SWA CLI -swa deploy ./dist \ - --deployment-token \ - --env production +az account list-locations --query "[].{name:name, displayName:displayName}" --output table ``` -**Plain HTML Site (Single File or No Build Step):** +2. Present the list of available regions to the user. If a default location was found in `azd config get defaults`, include it in the prompt: + - With default: "Which Azure region would you like to deploy to? (default from azd config: ``)" + - Without default: "Which Azure region would you like to deploy to?" -For plain HTML sites without a build process, SWA CLI requires content in a dedicated folder: +3. Set the location with the user-selected value: ```bash -# Create output directory and copy files -mkdir -p dist && cp -r *.html *.css *.js *.png *.jpg *.svg dist/ 2>/dev/null || true - -# Get deployment token -TOKEN=$(az staticwebapp secrets list \ - --name \ - --resource-group \ - --query "properties.apiKey" -o tsv) - -# Deploy from dist folder -swa deploy ./dist --deployment-token "$TOKEN" --env production - -# Clean up temp folder (optional) -rm -rf dist -``` - -**Using azd for Plain HTML Sites:** - -When using `azd` instead of raw `swa` commands for plain HTML sites, create this project structure: - -``` -my-static-site/ -├── azure.yaml # azd configuration -├── dist/ # Static content goes here (NOT in root) -│ └── index.html -└── infra/ - ├── main.bicep - ├── main.parameters.json - └── staticwebapp.bicep +azd env set AZURE_LOCATION ``` -**azure.yaml** - Note the critical settings: -```yaml -name: my-static-site -services: - web: - project: . - # IMPORTANT: dist must point to a folder containing ONLY static content - # Do NOT set dist to "." as it will include azure.yaml, infra/, .azure/, etc. - # which causes deployment issues (stuck in "Uploading" state) - dist: dist - host: staticwebapp - # IMPORTANT: Do NOT specify "language" for plain HTML sites - # Setting language (e.g., "html", "js") causes errors like: - # "language 'html' is not supported by built-in framework services" -``` +**If `AZURE_LOCATION` is set:** +- Proceed to Step 5 -**azure.yaml `language` property by host type:** -| Host Type | Language Property | Notes | -|-----------|-------------------|-------| -| `staticwebapp` | **Do NOT specify** for plain HTML | Only needed for managed Functions API | -| `containerapp` | Optional - used for build detection | Values: `js`, `ts`, `python`, `csharp`, `java`, `go` | -| `appservice` | Required for runtime selection | Values: `js`, `ts`, `python`, `csharp`, `java` | -| `function` | Required for runtime | Values: `js`, `ts`, `python`, `csharp`, `java` | - -> 💡 **Validate azure.yaml before deployment** using the MCP tool: -> ```javascript -> const validation = await azure-azd({ -> command: "validate_azure_yaml", -> parameters: { path: "./azure.yaml" } -> }); -> ``` - -**infra/staticwebapp.bicep** - Must include the `azd-service-name` tag: -```bicep -@description('Name of the Static Web App') -param name string - -@description('Location for the Static Web App') -param location string - -resource staticWebApp 'Microsoft.Web/staticSites@2022-09-01' = { - name: name - location: location - // REQUIRED: This tag links the Bicep resource to the service in azure.yaml - tags: { - 'azd-service-name': 'web' - } - sku: { - name: 'Free' - tier: 'Free' - } - properties: {} -} - -output name string = staticWebApp.name -output uri string = 'https://${staticWebApp.properties.defaultHostname}' -``` +### Step 5: Deploy -Then deploy with: +Execute: ```bash -azd up +azd up --no-prompt ``` -**Smart defaults:** -- SKU: `Free` for dev/test, `Standard` for production -- Location: SWA has limited regions - use `centralus`, `eastus2`, `westus2`, `westeurope`, or `eastasia` - -See [Static Web Apps Guide](./reference/static-web-apps.md) for detailed configuration. - -### 4.2 Azure Functions Deployment +The `--no-prompt` flag is required to prevent interactive prompts from blocking execution. -> 💡 **For advanced Functions deployment scenarios**, see the **[Azure Functions Deployment Guide](./reference/functions.md)** which provides: -> - Function project initialization and templating -> - Detailed trigger/binding configuration -> - Deployment slots and CI/CD patterns -> - Function-specific troubleshooting -> - Complete MCP tool integration +This command provisions all Azure resources defined in `infra/` and deploys the application code. -**Create and deploy:** +**Alternative:** To provision and deploy separately: ```bash -# Create resource group -az group create --name --location - -# Create storage account (required for Functions) -az storage account create \ - --name \ - --resource-group \ - --location \ - --sku Standard_LRS - -# Create Function App -az functionapp create \ - --name \ - --resource-group \ - --storage-account \ - --consumption-plan-location \ - --runtime \ - --runtime-version \ - --functions-version 4 - -# Deploy with func CLI -func azure functionapp publish +azd provision --no-prompt # Create Azure resources +azd deploy --no-prompt # Deploy application code ``` -**Smart defaults:** -- Plan: Consumption (pay-per-execution) for most cases -- Runtime version: Latest LTS for the detected language - -See [Azure Functions Guide](./reference/functions.md) for advanced scenarios. - -### 4.3 App Service Deployment - -**Create and deploy:** +**To preview changes before deployment:** ```bash -# Create resource group -az group create --name --location - -# Create App Service plan -az appservice plan create \ - --name \ - --resource-group \ - --location \ - --sku B1 \ - --is-linux - -# Create Web App -az webapp create \ - --name \ - --resource-group \ - --plan \ - --runtime "" - -# Deploy code (zip deploy) -az webapp deploy \ - --name \ - --resource-group \ - --src-path \ - --type zip -``` - -**Runtime values by language:** -- Node.js: `"NODE:18-lts"`, `"NODE:20-lts"` -- Python: `"PYTHON:3.11"`, `"PYTHON:3.12"` -- .NET: `"DOTNETCORE:8.0"` -- Java: `"JAVA:17-java17"` - -**Smart defaults:** -- Plan SKU: `B1` for dev/test, `P1v3` for production -- Always use Linux (`--is-linux`) unless .NET Framework required - -See [App Service Guide](./reference/app-service.md) for configuration options. - ---- - -## Phase 5: Multi-Service Deployment (azd + IaC) - -When multiple services or infrastructure dependencies are detected, recommend Azure Developer CLI with Infrastructure as Code. - -### When to Use azd -- Multiple deployable components (frontend + API + functions) -- Needs database, cache, storage, or messaging services -- Requires consistent environments (dev, staging, production) -- Team collaboration with reproducible infrastructure - -### Initialize azd Project -```bash -# Initialize from scratch -azd init - -# Or use a template -azd init --template -``` - -### Project Structure -``` -project/ -├── azure.yaml # azd configuration -├── infra/ -│ ├── main.bicep # Main infrastructure -│ ├── main.parameters.json -│ └── modules/ # Reusable modules -├── src/ -│ ├── web/ # Frontend -│ └── api/ # Backend +azd provision --preview ``` -### Deploy with azd - -**Step 1: Validate azure.yaml before deployment** - -Always validate the azure.yaml configuration before running deployment commands: - -```javascript -// Validate azure.yaml using MCP tool -const validation = await azure-azd({ - command: "validate_azure_yaml", - parameters: { path: "./azure.yaml" } -}); +### Step 6: Handle Errors -// Check for validation errors -if (validation.errors && validation.errors.length > 0) { - // Report errors to user and fix before proceeding - console.error("azure.yaml validation failed:", validation.errors); - return; +If `azd up` fails, call the `azure__azd` MCP tool: +```json +{ + "command": "error_troubleshooting", + "parameters": {} } ``` -**Step 2: Deploy** - -```bash -# Provision infrastructure + deploy code -azd up - -# For automation/agent scenarios - use --no-prompt to avoid interactive prompts -azd up --no-prompt - -# Or separately: -azd provision --no-prompt # Create infrastructure -azd deploy --no-prompt # Deploy application code +Common error resolutions: +- "Not authenticated" → Run `azd auth login` +- "Environment not found" → Run `azd env new ` +- "azure.yaml invalid" → Use azure-create-app skill to regenerate +- "Bicep compilation error" → Check module paths and parameters +- "Provision failed" → Check resource quotas and permissions +- "Package failed" → Verify Dockerfile and build configuration -# Preview changes before deployment -azd provision --preview - -# Manage environments -azd env new staging -azd env select staging -azd up --no-prompt -``` - -> ⚠️ **CRITICAL for automation**: Always use `--no-prompt` when azd is called by an agent or in CI/CD pipelines where interactive prompts cannot be answered. +--- -**Step 3: On errors, use MCP troubleshooting** +## Environment Management -```javascript -// If azd commands fail, get troubleshooting guidance -const troubleshooting = await azure-azd({ - command: "error_troubleshooting" -}); +```bash +azd env new # Create environment +azd env select # Switch environment +azd env set AZURE_LOCATION eastus # Set variable +azd env list # List environments ``` -See [Multi-Service Guide](./reference/multi-service.md) for azure.yaml configuration. -See [Azure Verified Modules](./reference/azure-verified-modules.md) for Bicep module reference. - --- -## Troubleshooting Quick Reference +## Post-Deployment Commands -### Common Issues - -**"Not logged in" errors:** ```bash -az login -az account set --subscription "" +azd monitor --logs # View logs +azd monitor --overview # Open Azure Portal ``` -**"Resource group not found":** +**Cleanup (DESTRUCTIVE):** ```bash -az group create --name --location +azd down --force --purge ``` -**SWA deployment fails:** -- Check build output directory is correct -- Verify deployment token is valid -- Ensure `staticwebapp.config.json` is properly formatted - -**Functions deployment fails:** -- Verify `host.json` exists -- Check runtime version matches function app configuration -- Ensure storage account is accessible - -**App Service deployment fails:** -- Verify runtime matches application -- Check startup command if using custom entry point -- Review deployment logs: `az webapp log tail --name --resource-group ` - -See [Troubleshooting Guide](./reference/troubleshooting.md) for detailed solutions. - ---- - -## Deployment Reference Guides - -For specialized deployment scenarios, use these comprehensive reference guides: - -- **🌐 [Static Web Apps Deployment Guide](./reference/static-web-apps.md)** - Static Web Apps deployment with SWA CLI, local emulation, GitHub Actions, API integration, and database connections -- **🐳 [Container Apps Deployment Guide](./reference/container-apps.md)** - Container Apps deployment with Docker validation, ACR integration, Container Apps Jobs, and multi-container orchestration -- **⚡ [Azure Functions Deployment Guide](./reference/functions.md)** - Azure Functions deployment with func CLI, triggers/bindings, deployment slots, and function-specific troubleshooting -- **☸️ [AKS Deployment Guide](./reference/aks.md)** - Kubernetes deployments with full control, custom operators, and complex microservices -- **🌍 [App Service Deployment Guide](./reference/app-service.md)** - Traditional web applications and REST APIs with managed hosting - ---- - -Load these guides as needed for detailed information: - -- [Static Web Apps Guide](./reference/static-web-apps.md) - Static frontends and JAMstack apps with SWA CLI, managed Functions APIs, GitHub Actions, and authentication -- [Container Apps Guide](./reference/container-apps.md) - Comprehensive Container Apps deployment with azd, Docker best practices, Jobs, scaling, and troubleshooting -- [Azure Functions Guide](./reference/functions.md) - Serverless Functions deployment with func CLI, triggers/bindings, deployment slots, and monitoring -- [AKS Guide](./reference/aks.md) - Kubernetes deployment with AKS, node pools, workload identity, scaling, and networking -- [App Service Guide](./reference/app-service.md) - Traditional web app deployment with App Service plans, deployment slots, and auto-scaling -- Always scan the workspace before generating a deployment plan -- Plans integrate with Azure Developer CLI (azd) -- Logs require resources deployed through azd -- Run `/azure:preflight` before any deployment to avoid mid-deployment failures +WARNING: `azd down` permanently deletes ALL resources including databases with data, storage accounts with files, and Key Vaults with secrets. diff --git a/plugin/skills/azure-deployment-preflight/SKILL.md b/plugin/skills/azure-deployment-preflight/SKILL.md index 31d64c43..6b98a231 100644 --- a/plugin/skills/azure-deployment-preflight/SKILL.md +++ b/plugin/skills/azure-deployment-preflight/SKILL.md @@ -62,7 +62,7 @@ Determine the deployment workflow by checking for project indicators: For azd projects, validate the `azure.yaml` configuration using the Azure MCP azd tool: ```javascript -const validation = await azure-azd({ +const validation = await azure__azd({ command: "validate_azure_yaml", parameters: { path: "./azure.yaml" } }); @@ -233,7 +233,7 @@ This skill uses the following tools: ### Azure MCP azd Tools -Use the Azure MCP server's azd tools (`azure-azd`) for additional validation: +Use the Azure MCP server's azd tools (`azure__azd`) for additional validation: | Command | Description | |---------|-------------| @@ -243,7 +243,7 @@ Use the Azure MCP server's azd tools (`azure-azd`) for additional validation: **Validate azure.yaml before running `azd provision --preview`:** ```javascript -const validation = await azure-azd({ +const validation = await azure__azd({ command: "validate_azure_yaml", parameters: { path: "./azure.yaml" } }); @@ -260,7 +260,7 @@ bicep --version 1. User: "Validate my Bicep deployment before I run it" 2. Agent detects `azure.yaml` → azd project -3. Agent validates `azure.yaml` using `azure-azd` → `validate_azure_yaml` +3. Agent validates `azure.yaml` using `azure__azd` → `validate_azure_yaml` 4. Agent finds `infra/main.bicep` and `infra/main.bicepparam` 5. Agent runs `bicep build infra/main.bicep --stdout` 6. Agent runs `azd provision --preview` diff --git a/plugin/skills/azure-mcp/SKILL.md b/plugin/skills/azure-mcp/SKILL.md index 01a90a34..f6113cd0 100644 --- a/plugin/skills/azure-mcp/SKILL.md +++ b/plugin/skills/azure-mcp/SKILL.md @@ -242,6 +242,20 @@ The Azure MCP server exposes two types of tools: | `azure__bicepschema` | *(schema queries)* | Get Bicep resource type schemas | | `azure__quota` | `quota_region_availability_list` | Check regional quota and availability | +## Azure Developer CLI (azd) + +| Tool | Command | Description | +|------|---------|-------------| +| `azure__azd` | `validate_azure_yaml` | Validate azure.yaml against official JSON schema | +| `azure__azd` | `discovery_analysis` | Analyze application components for azd migration | +| `azure__azd` | `architecture_planning` | Select Azure services for discovered components | +| `azure__azd` | `azure_yaml_generation` | Generate azure.yaml configuration | +| `azure__azd` | `docker_generation` | Generate Dockerfiles for Container Apps/AKS | +| `azure__azd` | `infrastructure_generation` | Generate Bicep templates | +| `azure__azd` | `iac_generation_rules` | Get Bicep compliance rules and best practices | +| `azure__azd` | `project_validation` | Comprehensive validation before deployment | +| `azure__azd` | `error_troubleshooting` | Diagnose and troubleshoot azd errors | + ## Best Practices | Tool | Command | Description |