{"id":42439,"date":"2025-02-20T00:25:29","date_gmt":"2025-02-20T07:25:29","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/premier-developer\/?p=42439"},"modified":"2025-02-18T12:16:41","modified_gmt":"2025-02-18T19:16:41","slug":"deploying-webjobs-to-azure-container-apps","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/deploying-webjobs-to-azure-container-apps\/","title":{"rendered":"Deploying WebJobs to Azure Container Apps"},"content":{"rendered":"<p><a href=\"https:\/\/www.linkedin.com\/in\/debjyoti-ganguly-5a4862144\/\" target=\"_blank\" rel=\"noopener\">Debjyoti Ganguly<\/a> walks through the process of migrating existing WebJobs to Azure Container App Jobs, highlighting the benefits and providing practical steps to implement this migration effectively<\/p>\n<hr \/>\n<p><strong>Introduction\n<\/strong>As businesses scale, the need for a robust and scalable environment for running background jobs becomes essential. Azure Container App Jobs offer a modern, scalable, and containerized solution for running background jobs, providing significant benefits over traditional Azure WebJobs. This guide will walk you through the process of migrating existing WebJobs to Azure Container App Jobs, highlighting the benefits and providing practical steps to implement this migration effectively.<\/p>\n<p><strong>Benefits of Azure Container App Jobs over Azure WebJobs<\/strong><\/p>\n<ul>\n<li>Scalability: Automatically scales based on demand without manual intervention.<\/li>\n<li>Flexibility: Supports a wide range of runtime environments and programming languages.<\/li>\n<li>Isolation: Each job runs in its isolated container, enhancing security and reliability.<\/li>\n<li>Seamless Integration: Easily integrates with other Azure services like Azure Key Vault, SQL Server, and Azure Storage.<img decoding=\"async\" class=\"alignnone wp-image-42440\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/word-image-42439-2-1024x809.png\" alt=\"\" width=\"800\" height=\"632\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/word-image-42439-2-1024x809.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/word-image-42439-2-300x237.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/word-image-42439-2-768x607.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/word-image-42439-2.png 1276w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 40px;\"><strong>1.1.1 Quick Flow of the Implementation<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-42441\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-screen-ai-generated-co.png\" alt=\"A screenshot of a computer screen AI-generated content may be incorrect.\" width=\"800\" height=\"214\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-screen-ai-generated-co.png 1430w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-screen-ai-generated-co-300x80.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-screen-ai-generated-co-1024x274.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-screen-ai-generated-co-768x206.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p><strong>\nAzure Resource Deployment as Infra Setup\n<\/strong><\/p>\n<p>Below security measures and recommendations should be implemented while deploying the Azure Container App Managed Environment and Azure Container Registry (ACR) to ensure robust and secure infrastructure.<\/p>\n<p>Security Measures and Recommendations<\/p>\n<ol>\n<li>System-Assigned Managed Identity<\/li>\n<li>Network Isolation with Private endpoints<\/li>\n<li>Role-Based Access Control (RBAC)<\/li>\n<li>Container Image Scanning using Microsoft Cloud Defender<\/li>\n<li>Data Encryption<\/li>\n<li>Audit and Monitoring with Application Insights<\/li>\n<\/ol>\n<p>By implementing these security measures, we ensure that our infrastructure setup for Azure Container Apps and ACR is secure, resilient, and compliant with best practices, providing a solid foundation for running containerized workloads in the cloud.<\/p>\n<p>Note \u2013\nCheck out my public GitHub Gist, which contains a sample of Infrastructure as Code (IAC) \/ Bicep that you can use to set up your resources and develop according to your requirements.<\/p>\n<p><a href=\"https:\/\/gist.github.com\/Debjyoti30\/ff3bec45dbe2935cfd3d0af7e4bcce1e\">https:\/\/gist.github.com\/Debjyoti30\/ff3bec45dbe2935cfd3d0af7e4bcce1e<\/a><\/p>\n<p>Push your changes using Pull request to the Infra deployment branch and once merged it will trigger your infra-deployment pipeline.<\/p>\n<p>Infra-deployment Pipeline :-<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-42442\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-ai-generated-content-m.png\" alt=\"A screenshot of a computer AI-generated content may be incorrect.\" width=\"800\" height=\"311\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-ai-generated-content-m.png 3417w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-ai-generated-content-m-300x117.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-ai-generated-content-m-1024x398.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-ai-generated-content-m-768x299.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-ai-generated-content-m-1536x597.png 1536w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-ai-generated-content-m-2048x797.png 2048w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>To fork the same &#8211; <a href=\"https:\/\/gist.github.com\/Debjyoti30\/ac765b9fdc1f8dca1f9da8833d14cb1f\">https:\/\/gist.github.com\/Debjyoti30\/ac765b9fdc1f8dca1f9da8833d14cb1f<\/a><\/p>\n<p><strong>CI\/CD Setup for the Image build and Azure Container app job provision<\/strong>:-\n1. Pack and push Dockerfile as an artifact.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-42443\" src=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-program-ai-generated-c.png\" alt=\"A screenshot of a computer program AI-generated content may be incorrect.\" width=\"800\" height=\"602\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-program-ai-generated-c.png 2040w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-program-ai-generated-c-300x226.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-program-ai-generated-c-1024x771.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-program-ai-generated-c-768x578.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2025\/02\/a-screenshot-of-a-computer-program-ai-generated-c-1536x1157.png 1536w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>To fork this sample &#8211;\n<a href=\"https:\/\/gist.github.com\/Debjyoti30\/bf16184bfd45e9c749ca19d030fb7d35\">https:\/\/gist.github.com\/Debjyoti30\/bf16184bfd45e9c749ca19d030fb7d35<\/a><\/p>\n<p><strong>Task Significance in the Pipeline<\/strong><\/p>\n<p><strong>ArchiveFiles@2 Task:<\/strong><\/p>\n<p>This task packages the Dockerfile and related files from the specified sourcePath.<\/p>\n<p>The files are archived into a .zip file.<\/p>\n<p>The archive file is named using the packageName and packageVersion variables and saved to the outputPath.<\/p>\n<p><strong>PublishBuildArtifacts@1 Task:<\/strong><\/p>\n<p>This task publishes the packaged .zip file to Azure Artifacts.<\/p>\n<p>The package can later be retrieved and used by the CD pipeline for building the Docker image.<\/p>\n<p>This pipeline captures the intent of packaging the Dockerfile and its dependencies into an artifact that can be consumed by subsequent stages, aligning with your goal of separating the packaging and building processes.<\/p>\n<p>&nbsp;<\/p>\n<p>2. Download the Artifact and create Azure Container App Job ( CD Setup )<\/p>\n<p>Pipeline Config &#8211; <a href=\"https:\/\/gist.github.com\/Debjyoti30\/518fe40eb892d020badb29ca884836a2\">https:\/\/gist.github.com\/Debjyoti30\/518fe40eb892d020badb29ca884836a2<\/a><\/p>\n<p><strong>Task Significance in the Pipeline<\/strong><\/p>\n<ol>\n<li><strong>DownloadPipelineArtifact@2 Task<\/strong>:\n<ul>\n<li>Downloads the Dockerfile package from Azure Artifacts to the pipeline workspace.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Bash@3 Task (Build and Push)<\/strong>:\n<ul>\n<li>Uses the Azure CLI to log in to ACR.<\/li>\n<li>Builds the Docker image using the downloaded Dockerfile.<\/li>\n<li>Tags the image with the Azure Pipeline&#8217;s build ID.<\/li>\n<li>Pushes the Docker image to the ACR.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Bash@3 Task (Create Container App Job)<\/strong>:\n<ul>\n<li>Uses the Azure CLI to create the Azure Container App Job from the pushed image, using the ACR image and the specified environment.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Debjyoti Ganguly walks through the process of migrating existing WebJobs to Azure Container App Jobs, highlighting the benefits and providing practical steps to implement this migration effectively Introduction As businesses scale, the need for a robust and scalable environment for running background jobs becomes essential. Azure Container App Jobs offer a modern, scalable, and containerized [&hellip;]<\/p>\n","protected":false},"author":582,"featured_media":42444,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[25],"tags":[10666,10665,10664],"class_list":["post-42439","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","tag-aca","tag-azure-container-apps","tag-webjobs"],"acf":[],"blog_post_summary":"<p>Debjyoti Ganguly walks through the process of migrating existing WebJobs to Azure Container App Jobs, highlighting the benefits and providing practical steps to implement this migration effectively Introduction As businesses scale, the need for a robust and scalable environment for running background jobs becomes essential. Azure Container App Jobs offer a modern, scalable, and containerized [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/42439","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=42439"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/42439\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/42444"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=42439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=42439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=42439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}