Skip to main content
Glama

azure_container_apps_deploy

Deploy container applications to Azure Container Apps for managing DevOps workflows and cloud deployments.

Instructions

Deploy container to Azure Container Apps

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Primary handler function implementing the tool logic: creates Container Apps environment if needed, deploys the image via az CLI, handles ACR images, retrieves and returns the app FQDN URL.
    let output = ""; const envName = environment || `${app_name}-env`; // Check if environment exists, create if not const envCheck = await runCommand(`az containerapp env show -n ${envName} -g ${resource_group} 2>/dev/null`); if (!envCheck.success) { output += `Creating Container Apps environment: ${envName}...\n`; const envCreate = await runCommand( `az containerapp env create -n ${envName} -g ${resource_group}`, { timeout: 300000 } ); if (!envCreate.success) { return { content: [{ type: "text", text: `Failed to create environment!\n\nError: ${envCreate.stderr || envCreate.error}` }] }; } output += `Environment created.\n\n`; } // Deploy container app output += `Deploying container app: ${app_name}...\n`; // Determine if this is an ACR image const isAcr = image.includes(".azurecr.io"); let registryArgs = ""; if (isAcr) { const acrName = image.split(".")[0]; registryArgs = `--registry-server ${acrName}.azurecr.io`; } const deployCmd = `az containerapp create \\ -n ${app_name} \\ -g ${resource_group} \\ --environment ${envName} \\ --image ${image} \\ --target-port ${port} \\ --ingress external \\ --cpu ${cpu} \\ --memory ${memory} \\ ${registryArgs}`; const deploy = await runCommand(deployCmd.replace(/\\\n/g, " "), { timeout: 300000 }); if (!deploy.success) { return { content: [{ type: "text", text: `Failed to deploy!\n\nError: ${deploy.stderr || deploy.error}\n\nCommand:\n${deployCmd}\n\nCommon issues:\n- Image not found in registry\n- Registry authentication failed\n- Resource quota exceeded` }] }; } // Get the app URL const appUrl = await runCommand(`az containerapp show -n ${app_name} -g ${resource_group} --query properties.configuration.ingress.fqdn -o tsv`); output += ` Deployment successful! APP DETAILS: ------------ Name: ${app_name} Resource Group: ${resource_group} Image: ${image} URL: https://${appUrl.stdout} USEFUL COMMANDS: ---------------- # View logs az containerapp logs show -n ${app_name} -g ${resource_group} --follow # Scale replicas az containerapp update -n ${app_name} -g ${resource_group} --min-replicas 1 --max-replicas 10 # Update image az containerapp update -n ${app_name} -g ${resource_group} --image ${image} # View revisions az containerapp revision list -n ${app_name} -g ${resource_group} -o table ENVIRONMENT VARIABLES: ---------------------- az containerapp update -n ${app_name} -g ${resource_group} \\ --set-env-vars "KEY=value" "DATABASE_URL=secretref:db-url" SECRETS: -------- az containerapp secret set -n ${app_name} -g ${resource_group} \\ --secrets "db-url=your-connection-string"`; return { content: [{ type: "text", text: output }] }; }
  • Input schema defining parameters for the azure_container_apps_deploy tool with types, descriptions, and defaults.
    app_name: { type: "string", description: "Container app name" }, resource_group: { type: "string", description: "Resource group name" }, image: { type: "string", description: "Container image (e.g., myacr.azurecr.io/app:latest)" }, environment: { type: "string", description: "Container Apps environment name", default: "" }, port: { type: "number", description: "Container port", default: 8080 }, cpu: { type: "string", description: "CPU cores (0.25, 0.5, 1, 2)", default: "0.5" }, memory: { type: "string", description: "Memory (0.5Gi, 1Gi, 2Gi, 4Gi)", default: "1Gi" } }, async ({ app_name, resource_group, image, environment, port, cpu, memory }) => {
  • src/index.js:1280-1386 (registration)
    MCP server.tool registration call that registers the tool with name, description, schema, and handler function.
    "azure_container_apps_deploy", "Deploy container to Azure Container Apps", { app_name: { type: "string", description: "Container app name" }, resource_group: { type: "string", description: "Resource group name" }, image: { type: "string", description: "Container image (e.g., myacr.azurecr.io/app:latest)" }, environment: { type: "string", description: "Container Apps environment name", default: "" }, port: { type: "number", description: "Container port", default: 8080 }, cpu: { type: "string", description: "CPU cores (0.25, 0.5, 1, 2)", default: "0.5" }, memory: { type: "string", description: "Memory (0.5Gi, 1Gi, 2Gi, 4Gi)", default: "1Gi" } }, async ({ app_name, resource_group, image, environment, port, cpu, memory }) => { let output = ""; const envName = environment || `${app_name}-env`; // Check if environment exists, create if not const envCheck = await runCommand(`az containerapp env show -n ${envName} -g ${resource_group} 2>/dev/null`); if (!envCheck.success) { output += `Creating Container Apps environment: ${envName}...\n`; const envCreate = await runCommand( `az containerapp env create -n ${envName} -g ${resource_group}`, { timeout: 300000 } ); if (!envCreate.success) { return { content: [{ type: "text", text: `Failed to create environment!\n\nError: ${envCreate.stderr || envCreate.error}` }] }; } output += `Environment created.\n\n`; } // Deploy container app output += `Deploying container app: ${app_name}...\n`; // Determine if this is an ACR image const isAcr = image.includes(".azurecr.io"); let registryArgs = ""; if (isAcr) { const acrName = image.split(".")[0]; registryArgs = `--registry-server ${acrName}.azurecr.io`; } const deployCmd = `az containerapp create \\ -n ${app_name} \\ -g ${resource_group} \\ --environment ${envName} \\ --image ${image} \\ --target-port ${port} \\ --ingress external \\ --cpu ${cpu} \\ --memory ${memory} \\ ${registryArgs}`; const deploy = await runCommand(deployCmd.replace(/\\\n/g, " "), { timeout: 300000 }); if (!deploy.success) { return { content: [{ type: "text", text: `Failed to deploy!\n\nError: ${deploy.stderr || deploy.error}\n\nCommand:\n${deployCmd}\n\nCommon issues:\n- Image not found in registry\n- Registry authentication failed\n- Resource quota exceeded` }] }; } // Get the app URL const appUrl = await runCommand(`az containerapp show -n ${app_name} -g ${resource_group} --query properties.configuration.ingress.fqdn -o tsv`); output += ` Deployment successful! APP DETAILS: ------------ Name: ${app_name} Resource Group: ${resource_group} Image: ${image} URL: https://${appUrl.stdout} USEFUL COMMANDS: ---------------- # View logs az containerapp logs show -n ${app_name} -g ${resource_group} --follow # Scale replicas az containerapp update -n ${app_name} -g ${resource_group} --min-replicas 1 --max-replicas 10 # Update image az containerapp update -n ${app_name} -g ${resource_group} --image ${image} # View revisions az containerapp revision list -n ${app_name} -g ${resource_group} -o table ENVIRONMENT VARIABLES: ---------------------- az containerapp update -n ${app_name} -g ${resource_group} \\ --set-env-vars "KEY=value" "DATABASE_URL=secretref:db-url" SECRETS: -------- az containerapp secret set -n ${app_name} -g ${resource_group} \\ --secrets "db-url=your-connection-string"`; return { content: [{ type: "text", text: output }] }; } );
  • Testing/exported version of the handler function (identical logic), exported for unit testing purposes.
    export async function azureContainerAppsDeploy({ app_name, resource_group, image, environment, port, cpu, memory }) { const envName = environment || `${app_name}-env`; let output = ""; const envCheck = await commandRunner(`az containerapp env show -n ${envName} -g ${resource_group} 2>/dev/null`); if (!envCheck.success) { output += `Creating Container Apps environment: ${envName}...\n`; const envCreate = await commandRunner( `az containerapp env create -n ${envName} -g ${resource_group}`, { timeout: 300000 } ); if (!envCreate.success) { return { content: [{ type: "text", text: `Failed to create environment!\n\nError: ${envCreate.stderr || envCreate.error}` }] }; } output += `Environment created.\n\n`; } output += `Deploying container app: ${app_name}...\n`; const isAcr = image.includes(".azurecr.io"); let registryArgs = ""; if (isAcr) { const acrName = image.split(".")[0]; registryArgs = `--registry-server ${acrName}.azurecr.io`; } const deployCmd = `az containerapp create -n ${app_name} -g ${resource_group} --environment ${envName} --image ${image} --target-port ${port} --ingress external --cpu ${cpu} --memory ${memory} ${registryArgs}`; const deploy = await commandRunner(deployCmd, { timeout: 300000 }); if (!deploy.success) { return { content: [{ type: "text", text: `Failed to deploy!\n\nError: ${deploy.stderr || deploy.error}` }] }; } const appUrl = await commandRunner(`az containerapp show -n ${app_name} -g ${resource_group} --query properties.configuration.ingress.fqdn -o tsv`); output += `\nDeployment successful!\n\nApp: ${app_name}\nURL: https://${appUrl.stdout}`; return { content: [{ type: "text", text: output }] }; }
  • src/tools.js:576-597 (registration)
    Exported tools object including azureContainerAppsDeploy for testing/import in other contexts.
    export const tools = { // Git gitStatusExplained, gitBranchExplained, gitCommitGuided, // Docker dockerCheckSetup, dockerAnalyzeProject, dockerBuild, // GitHub githubSecretsList, githubSecretsSet, // Azure azureCheckCli, azureAcrSetup, azureContainerAppsDeploy, // SonarCloud sonarcloudSetupGuide, sonarcloudCreateConfig, // Onboarding devOnboardingCheck, };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rideRTD/RTD-DevOps'

If you have feedback or need assistance with the MCP directory API, please join our Discord server