Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 170 additions & 0 deletions plugin/skills/azure-create-app/SKILL.md
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -57,51 +58,35 @@ 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

---

## Quick Reference

| 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 |

---

## Prerequisites

### 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
Expand All @@ -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:**
Expand All @@ -133,25 +118,23 @@ 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 "<name-or-id>"
# Verify login status
azd auth login --check-status

# Login to azd
azd auth login
# Set environment and subscription
azd env new <environment-name>
azd env set AZURE_SUBSCRIPTION_ID "<subscription-id>"
```

---

## 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
Expand All @@ -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 |
|---------|-------------|
Expand All @@ -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" }
});
Expand Down Expand Up @@ -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
Expand Down
Loading