Skip to content

Robertjam954/multimodal_rag_application / .claude/skills/azure-deploy

azure-deploy

Flagged

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.

FileKindSize
SKILL.mdskill md6.5 KB
references/auth-best-practices.mdmarkdown6.1 KB
references/global-rules.mdmarkdown1.2 KB
references/live-role-verification.mdmarkdown3.9 KB
references/pre-deploy-checklist.mdmarkdown18.4 KB
references/recipes/README.mdmarkdown431 B
references/recipes/azcli/README.mdmarkdown1.7 KB
references/recipes/azcli/errors.mdmarkdown492 B
references/recipes/azcli/verify.mdmarkdown2.0 KB
references/recipes/azd/README.mdmarkdown3.7 KB
references/recipes/azd/ef-migrations.mdmarkdown5.0 KB
references/recipes/azd/errors.mdmarkdown15.4 KB
references/recipes/azd/functions-deploy.mdmarkdown3.5 KB
references/recipes/azd/post-deployment.mdmarkdown4.2 KB
references/recipes/azd/scripts/apply-migrations.ps1script1.8 KB
references/recipes/azd/scripts/apply-migrations.shscript1.8 KB
references/recipes/azd/scripts/grant-and-migrate.ps1script4.2 KB
references/recipes/azd/scripts/grant-and-migrate.shscript4.3 KB
references/recipes/azd/sql-entra-auth.mdmarkdown2.5 KB
references/recipes/azd/sql-managed-identity.mdmarkdown7.4 KB
references/recipes/azd/verify.mdmarkdown4.9 KB
references/recipes/bicep/README.mdmarkdown2.4 KB
references/recipes/bicep/errors.mdmarkdown511 B
references/recipes/bicep/verify.mdmarkdown763 B
references/recipes/cicd/README.mdmarkdown1.2 KB
references/recipes/cicd/errors.mdmarkdown542 B
references/recipes/cicd/examples/azdo-azd.ymlconfig487 B
references/recipes/cicd/examples/azdo-multistage.ymlconfig831 B
references/recipes/cicd/examples/github-azd.ymlconfig782 B
references/recipes/cicd/examples/github-bicep.ymlconfig660 B
references/recipes/cicd/verify.mdmarkdown754 B
references/recipes/terraform/README.mdmarkdown3.2 KB
references/recipes/terraform/errors.mdmarkdown858 B
references/recipes/terraform/verify.mdmarkdown752 B
references/region-availability.mdmarkdown3.0 KB
references/sdk/azd-deployment.mdmarkdown792 B
references/sdk/azure-identity-dotnet.mdmarkdown941 B
references/sdk/azure-identity-java.mdmarkdown1.2 KB
references/sdk/azure-identity-py.mdmarkdown1.1 KB
references/sdk/azure-identity-ts.mdmarkdown1.1 KB
references/troubleshooting.mdmarkdown8.0 KB

references/recipes/azd/scripts/grant-and-migrate.ps1

View on GitHub
# Grant Azure SQL data-plane access to the managed identity AND apply EF Core migrations.
#
# USAGE: Copy this file to scripts/grant-and-migrate.ps1 in your project root and add
#        a postprovision hook in azure.yaml:
#
#   hooks:
#     postprovision:
#       posix:
#         shell: sh
#         run: ./scripts/grant-and-migrate.sh
#       windows:
#         shell: pwsh
#         run: ./scripts/grant-and-migrate.ps1
#
# ENVIRONMENT VARIABLES (sourced from azd env):
#   SQL_SERVER           - SQL server name (without .database.windows.net)
#   SQL_DATABASE         - Database name
#   AZURE_RESOURCE_GROUP - Resource group name
#   SERVICE_WEB_NAME     - App Service name (used when set, takes priority)
#   SERVICE_API_NAME     - API service name (fallback when SERVICE_WEB_NAME is not set)
#
# CONFIGURATION:
#   Set $AppProjectPath below to the path of your application project (.csproj directory)

$ErrorActionPreference = 'Stop'

$AppProjectPath = "src/api"  # Adjust to your project directory

# Load azd environment variables
azd env get-values | ForEach-Object {
    $name, $value = $_.Split('=', 2)
    Set-Item "env:$name" $value.Trim('"')
}

# Determine app identity name (App Service uses SERVICE_WEB_NAME, APIs use SERVICE_API_NAME)
$AppName = if ($env:SERVICE_WEB_NAME) { $env:SERVICE_WEB_NAME } else { $env:SERVICE_API_NAME }

if (-not $AppName) {
    throw "ERROR: Neither SERVICE_WEB_NAME nor SERVICE_API_NAME is set in azd environment."
}

# ─── Step 1: Grant SQL data-plane access ────────────────────────────────────
Write-Host "Granting SQL data-plane access to managed identity: $AppName"

$SqlQuery = @"
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = '$AppName')
  CREATE USER [$AppName] FROM EXTERNAL PROVIDER;

IF NOT EXISTS (
  SELECT 1 FROM sys.database_role_members drm
  JOIN sys.database_principals r ON drm.role_principal_id = r.principal_id
  JOIN sys.database_principals m ON drm.member_principal_id = m.principal_id
  WHERE r.name = 'db_datareader' AND m.name = '$AppName'
)
  ALTER ROLE db_datareader ADD MEMBER [$AppName];

IF NOT EXISTS (
  SELECT 1 FROM sys.database_role_members drm
  JOIN sys.database_principals r ON drm.role_principal_id = r.principal_id
  JOIN sys.database_principals m ON drm.member_principal_id = m.principal_id
  WHERE r.name = 'db_datawriter' AND m.name = '$AppName'
)
  ALTER ROLE db_datawriter ADD MEMBER [$AppName];

IF NOT EXISTS (
  SELECT 1 FROM sys.database_role_members drm
  JOIN sys.database_principals r ON drm.role_principal_id = r.principal_id
  JOIN sys.database_principals m ON drm.member_principal_id = m.principal_id
  WHERE r.name = 'db_ddladmin' AND m.name = '$AppName'
)
  ALTER ROLE db_ddladmin ADD MEMBER [$AppName];
"@

# Ensure the rdbms-connect extension is installed (provides 'az sql db query')
az extension show --name rdbms-connect 1>$null 2>$null
if ($LASTEXITCODE -ne 0) {
    az extension add --name rdbms-connect --yes
    if ($LASTEXITCODE -ne 0) {
        throw "Failed to install Azure CLI extension 'rdbms-connect', which is required for 'az sql db query'."
    }
}

az sql db query `
  --server $env:SQL_SERVER `
  --database $env:SQL_DATABASE `
  --resource-group $env:AZURE_RESOURCE_GROUP `
  --auth-mode ActiveDirectoryDefault `
  --queries $SqlQuery

Write-Host "SQL access granted successfully."

# ─── Step 2: Apply EF Core migrations ───────────────────────────────────────
# Install dotnet-ef only when it is not already installed
$globalTools = dotnet tool list --global 2>$null
if ($LASTEXITCODE -ne 0) {
    throw "Failed to list globally installed .NET tools."
}
if (-not ($globalTools | Select-String -Pattern '^\s*dotnet-ef\s')) {
    dotnet tool install --global dotnet-ef
    if ($LASTEXITCODE -ne 0) {
        throw "Failed to install dotnet-ef."
    }
}
$env:PATH += ";$env:USERPROFILE\.dotnet\tools"

$ConnectionString = "Server=tcp:$($env:SQL_SERVER).database.windows.net,1433;Database=$($env:SQL_DATABASE);Authentication=Active Directory Default;Encrypt=True;"

Write-Host "Applying EF Core migrations..."
Set-Location $AppProjectPath
dotnet ef database update --connection $ConnectionString
Write-Host "Migrations applied successfully."
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall