<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[CodeCraft Journal]]></title><description><![CDATA[My personal Substack]]></description><link>https://www.iamuttamchaturvedi.com</link><image><url>https://substackcdn.com/image/fetch/$s_!zqX-!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F933a711f-b855-4fb6-aff1-e56c4be35e9e_1280x1280.png</url><title>CodeCraft Journal</title><link>https://www.iamuttamchaturvedi.com</link></image><generator>Substack</generator><lastBuildDate>Mon, 18 May 2026 03:05:17 GMT</lastBuildDate><atom:link href="https://www.iamuttamchaturvedi.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Uttam Chaturvedi]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[iamuttamchaturvedi@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[iamuttamchaturvedi@substack.com]]></itunes:email><itunes:name><![CDATA[Uttam Chaturvedi]]></itunes:name></itunes:owner><itunes:author><![CDATA[Uttam Chaturvedi]]></itunes:author><googleplay:owner><![CDATA[iamuttamchaturvedi@substack.com]]></googleplay:owner><googleplay:email><![CDATA[iamuttamchaturvedi@substack.com]]></googleplay:email><googleplay:author><![CDATA[Uttam Chaturvedi]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Deploying Financial Microservices Architecture on Azure Using Terraform]]></title><description><![CDATA[Azure Terraform resource deployment]]></description><link>https://www.iamuttamchaturvedi.com/p/deploying-financial-microservices</link><guid isPermaLink="false">https://www.iamuttamchaturvedi.com/p/deploying-financial-microservices</guid><dc:creator><![CDATA[Uttam Chaturvedi]]></dc:creator><pubDate>Tue, 20 Jan 2026 18:08:49 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!fAsK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fAsK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fAsK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png 424w, https://substackcdn.com/image/fetch/$s_!fAsK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png 848w, https://substackcdn.com/image/fetch/$s_!fAsK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png 1272w, https://substackcdn.com/image/fetch/$s_!fAsK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fAsK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png" width="885" height="872" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:872,&quot;width&quot;:885,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:536571,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://www.iamuttamchaturvedi.com/i/185207857?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fAsK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png 424w, https://substackcdn.com/image/fetch/$s_!fAsK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png 848w, https://substackcdn.com/image/fetch/$s_!fAsK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png 1272w, https://substackcdn.com/image/fetch/$s_!fAsK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fef7aa298-4659-4abb-b4e2-b238a41a36fd_885x872.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Introduction</h2><p>In my previous article, we covered the basics of Terraform&#8212;what it is, why it is useful, and how to define infrastructure as code. In this article, we will move beyond the basics and look at a <strong>real&#8209;world use case</strong>, where we deploy cloud resources using <strong>Terraform on Microsoft Azure</strong>.</p><p>The goal of this article is not to deep&#8209;dive into business logic or financial calculations, but to demonstrate how Terraform can be used to provision and manage infrastructure for a <strong>microservices&#8209;based financial application</strong>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.iamuttamchaturvedi.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading CodeCraft Journal! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Link of previous article : <a href="https://www.c-sharpcorner.com/article/infrstructure-as-code-using-terraforms/">https://www.c-sharpcorner.com/article/infrstructure-as-code-using-terraforms/</a></p><p>Full Sourec code : <a href="https://github.com/iamuttamchaturvedi9/IaCWithTerraform">https://github.com/iamuttamchaturvedi9/IaCWithTerraform</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9oPD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9oPD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png 424w, https://substackcdn.com/image/fetch/$s_!9oPD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png 848w, https://substackcdn.com/image/fetch/$s_!9oPD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png 1272w, https://substackcdn.com/image/fetch/$s_!9oPD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9oPD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png" width="1326" height="634" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:634,&quot;width&quot;:1326,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:107060,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.iamuttamchaturvedi.com/i/185207857?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9oPD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png 424w, https://substackcdn.com/image/fetch/$s_!9oPD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png 848w, https://substackcdn.com/image/fetch/$s_!9oPD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png 1272w, https://substackcdn.com/image/fetch/$s_!9oPD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf318495-24f2-45f0-8f59-9c897775ac0f_1326x634.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We will consider a simplified <strong>balance transfer system</strong>, similar to what is commonly used in financial institutions.</p><p>At a high level:</p><ul><li><p>A user interacts with the system through an <strong>API Gateway</strong>.</p></li><li><p>The API Gateway forwards requests to different <strong>microservices</strong>.</p></li><li><p>Each microservice is responsible for a specific function, such as transactions, balance checks, transfers, and notifications.</p></li><li><p>Based on the available balance, a transaction is either completed or rejected.</p></li><li><p>The user is notified about the outcome of the transaction.</p></li></ul><p>This architecture is intentionally kept simple so that we can focus on <strong>infrastructure deployment using Terraform</strong>, rather than application&#8209;level implementation details.</p><h2>Architecture Flow</h2><p>The following steps describe the request flow in the system:</p><ol><li><p>The <strong>user</strong> sends a request (for example, a balance transfer) to the system.</p></li><li><p>The request reaches the <strong>API Gateway</strong>, which acts as a single entry point.</p></li><li><p>The API Gateway forwards the request to the appropriate <strong>transaction microservice</strong>.</p></li><li><p>The transaction service communicates asynchronously with other services:</p><ul><li><p><strong>Balance Service</strong> &#8211; checks the available balance</p></li><li><p><strong>Transfer Service</strong> &#8211; performs the fund transfer</p></li><li><p><strong>Notification Service</strong> &#8211; sends success or failure notifications</p></li></ul></li><li><p>Each service stores or retrieves data from its respective database:</p><ul><li><p>SQL databases for transaction&#8209;related data</p></li><li><p>Cosmos DB for notifications</p></li></ul></li></ol><h2>Scope of This Article</h2><p>In this article, we will:</p><ul><li><p>Focus on <strong>deploying Azure resources using Terraform</strong></p></li><li><p>Define infrastructure using Terraform configuration files</p></li><li><p>Understand how real&#8209;world microservices map to cloud resources</p></li></ul><p>We will <strong>not</strong>:</p><ul><li><p>Implement application code</p></li><li><p>Discuss transaction logic in detail</p></li><li><p>Cover CI/CD pipelines (this can be explored in a future article)</p></li></ul><h2>Setting Up Azure Environment Variables</h2><p>To allow Terraform to authenticate with Azure, we need to set the required environment variables.</p><p>After logging in using Azure CLI:</p><pre><code><code>az login --tenant &lt;tenant-id&gt;</code></code></pre><p>Replace with your own tenant-id</p><p>Set the following environment variables:</p><pre><code><code>export ARM_SUBSCRIPTION_ID="&lt;your-subscription-id&gt;"
 export ARM_TENANT_ID="&lt;your-tenant-id&gt;"
 export ARM_CLIENT_ID="&lt;your-client-id&gt;"
 export ARM_CLIENT_SECRET="&lt;your-client-secret&gt;"</code></code></pre><p>Use below command to create service principle</p><pre><code><code>az ad sp create-for-rbac --name financeapp  --role Contributor  --scopes "subscriptions/&lt;subscription-id&gt;"</code></code></pre><p>Output would be shown as respective values</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!V1ud!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!V1ud!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png 424w, https://substackcdn.com/image/fetch/$s_!V1ud!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png 848w, https://substackcdn.com/image/fetch/$s_!V1ud!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png 1272w, https://substackcdn.com/image/fetch/$s_!V1ud!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!V1ud!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png" width="1439" height="185" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:185,&quot;width&quot;:1439,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;2026-01-17_01h26_11&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="2026-01-17_01h26_11" title="2026-01-17_01h26_11" srcset="https://substackcdn.com/image/fetch/$s_!V1ud!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png 424w, https://substackcdn.com/image/fetch/$s_!V1ud!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png 848w, https://substackcdn.com/image/fetch/$s_!V1ud!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png 1272w, https://substackcdn.com/image/fetch/$s_!V1ud!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc840efbf-e770-4e27-8c38-f15a1230f1a0_1439x185.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Replace with your own subscription-id and tenant id in azure subscription</p><p>Client Id is equal to App Id created as shown above</p><p>Client Secret is password created as shown above</p><h3><strong>Terraform Providers have 3 main componenets which work together.</strong></h3><p><strong>Terraform Block</strong> - Configures Terraform settings and declares which providers you need</p><p><strong>Provider</strong> - Authenticates and configures your connection to cloud platforms (AWS, Azure, GCP, etc.). In our case we will use azure resurce manager</p><p><strong>Resources</strong> - The actual infrastructure components you want to create (servers, storage, networks, etc.)</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WYdF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WYdF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png 424w, https://substackcdn.com/image/fetch/$s_!WYdF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png 848w, https://substackcdn.com/image/fetch/$s_!WYdF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png 1272w, https://substackcdn.com/image/fetch/$s_!WYdF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WYdF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png" width="822" height="411" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:411,&quot;width&quot;:822,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Providers&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Providers" title="Providers" srcset="https://substackcdn.com/image/fetch/$s_!WYdF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png 424w, https://substackcdn.com/image/fetch/$s_!WYdF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png 848w, https://substackcdn.com/image/fetch/$s_!WYdF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png 1272w, https://substackcdn.com/image/fetch/$s_!WYdF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F644f3ed5-3c9f-4ad0-a8d6-b23fc9b56cf5_822x411.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now lets dive into real implementation:</p><p>Add following files named as data.txt and main.tf</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dLye!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dLye!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png 424w, https://substackcdn.com/image/fetch/$s_!dLye!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png 848w, https://substackcdn.com/image/fetch/$s_!dLye!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png 1272w, https://substackcdn.com/image/fetch/$s_!dLye!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dLye!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png" width="846" height="219" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:219,&quot;width&quot;:846,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;data&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="data" title="data" srcset="https://substackcdn.com/image/fetch/$s_!dLye!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png 424w, https://substackcdn.com/image/fetch/$s_!dLye!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png 848w, https://substackcdn.com/image/fetch/$s_!dLye!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png 1272w, https://substackcdn.com/image/fetch/$s_!dLye!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a09f034-e234-410b-8066-ad6bd92409b5_846x219.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2tZR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac941589-4091-4e3e-b119-104a68805a75_720x527.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2tZR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac941589-4091-4e3e-b119-104a68805a75_720x527.png 424w, https://substackcdn.com/image/fetch/$s_!2tZR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac941589-4091-4e3e-b119-104a68805a75_720x527.png 848w, https://substackcdn.com/image/fetch/$s_!2tZR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac941589-4091-4e3e-b119-104a68805a75_720x527.png 1272w, https://substackcdn.com/image/fetch/$s_!2tZR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac941589-4091-4e3e-b119-104a68805a75_720x527.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2tZR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac941589-4091-4e3e-b119-104a68805a75_720x527.png" width="720" height="527" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ac941589-4091-4e3e-b119-104a68805a75_720x527.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:527,&quot;width&quot;:720,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;main&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="main" title="main" srcset="https://substackcdn.com/image/fetch/$s_!2tZR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac941589-4091-4e3e-b119-104a68805a75_720x527.png 424w, https://substackcdn.com/image/fetch/$s_!2tZR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac941589-4091-4e3e-b119-104a68805a75_720x527.png 848w, https://substackcdn.com/image/fetch/$s_!2tZR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac941589-4091-4e3e-b119-104a68805a75_720x527.png 1272w, https://substackcdn.com/image/fetch/$s_!2tZR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fac941589-4091-4e3e-b119-104a68805a75_720x527.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now we can run following command to deploy our resources using terraform like terraform init ,terraform plan,terraform apply to deploy our resources. Files and details are described below.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pfLr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pfLr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png 424w, https://substackcdn.com/image/fetch/$s_!pfLr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png 848w, https://substackcdn.com/image/fetch/$s_!pfLr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png 1272w, https://substackcdn.com/image/fetch/$s_!pfLr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pfLr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png" width="1117" height="391" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:391,&quot;width&quot;:1117,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;MainCommands&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="MainCommands" title="MainCommands" srcset="https://substackcdn.com/image/fetch/$s_!pfLr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png 424w, https://substackcdn.com/image/fetch/$s_!pfLr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png 848w, https://substackcdn.com/image/fetch/$s_!pfLr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png 1272w, https://substackcdn.com/image/fetch/$s_!pfLr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8044ac78-1863-4701-94bd-c2e24821cc82_1117x391.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YJFz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YJFz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png 424w, https://substackcdn.com/image/fetch/$s_!YJFz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png 848w, https://substackcdn.com/image/fetch/$s_!YJFz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png 1272w, https://substackcdn.com/image/fetch/$s_!YJFz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YJFz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png" width="1097" height="365" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:365,&quot;width&quot;:1097,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;init&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="init" title="init" srcset="https://substackcdn.com/image/fetch/$s_!YJFz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png 424w, https://substackcdn.com/image/fetch/$s_!YJFz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png 848w, https://substackcdn.com/image/fetch/$s_!YJFz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png 1272w, https://substackcdn.com/image/fetch/$s_!YJFz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F521f221d-7ed9-4e78-8b74-c5ea38fc802b_1097x365.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ey1Q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ey1Q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png 424w, https://substackcdn.com/image/fetch/$s_!Ey1Q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png 848w, https://substackcdn.com/image/fetch/$s_!Ey1Q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png 1272w, https://substackcdn.com/image/fetch/$s_!Ey1Q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ey1Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png" width="1103" height="363" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:363,&quot;width&quot;:1103,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;plan&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="plan" title="plan" srcset="https://substackcdn.com/image/fetch/$s_!Ey1Q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png 424w, https://substackcdn.com/image/fetch/$s_!Ey1Q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png 848w, https://substackcdn.com/image/fetch/$s_!Ey1Q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png 1272w, https://substackcdn.com/image/fetch/$s_!Ey1Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6eb836c2-3636-449d-8060-5ea4281dc04c_1103x363.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!A0mO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!A0mO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png 424w, https://substackcdn.com/image/fetch/$s_!A0mO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png 848w, https://substackcdn.com/image/fetch/$s_!A0mO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png 1272w, https://substackcdn.com/image/fetch/$s_!A0mO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!A0mO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png" width="1091" height="365" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:365,&quot;width&quot;:1091,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;apply&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="apply" title="apply" srcset="https://substackcdn.com/image/fetch/$s_!A0mO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png 424w, https://substackcdn.com/image/fetch/$s_!A0mO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png 848w, https://substackcdn.com/image/fetch/$s_!A0mO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png 1272w, https://substackcdn.com/image/fetch/$s_!A0mO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdb04f49-a6ff-4afc-87ee-43e521c22cae_1091x365.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>After running final command. Output would look like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rk46!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rk46!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png 424w, https://substackcdn.com/image/fetch/$s_!rk46!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png 848w, https://substackcdn.com/image/fetch/$s_!rk46!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png 1272w, https://substackcdn.com/image/fetch/$s_!rk46!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rk46!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png" width="1080" height="338" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:338,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;rucommand&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="rucommand" title="rucommand" srcset="https://substackcdn.com/image/fetch/$s_!rk46!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png 424w, https://substackcdn.com/image/fetch/$s_!rk46!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png 848w, https://substackcdn.com/image/fetch/$s_!rk46!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png 1272w, https://substackcdn.com/image/fetch/$s_!rk46!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F290a35bc-437f-42e3-b080-71a4bc8fc0e5_1080x338.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Till now we have created resource group and appservice plan . Now lets create other services .</strong></p><pre><code><code># API Gateway

resource "azurerm_service_plan" "plan_apigateway" {
    name = "plan_apigateway-northeurope"
    location = "northeurope"
    resource_group_name = azurerm_resource_group.rg.name
    os_type = "Linux"
    sku_name = "F1"
}</code></code></pre><p>This resource creates an <strong>Azure App Service Plan</strong>, which defines the compute resources used by one or more web applications.</p><ul><li><p><strong>Linux-based plan</strong>: The <code>os_type = "Linux"</code> enables containerized workloads and modern application stacks.</p></li><li><p><strong>Free tier (F1)</strong>: Using the <code>F1</code> SKU keeps costs at zero, making it ideal for development, testing, or proof-of-concept environments.</p></li><li><p><strong>Regional deployment</strong>: The plan is deployed to the <em>North Europe</em> region, ensuring consistency with other resources.</p></li></ul><p>The App Service Plan acts as the underlying infrastructure that hosts our API Gateway application.</p><div><hr></div><pre><code><code>resource  "azurerm_linux_web_app" "appservice-apigateway" {
    name = "appserv-apigateway-northeurope"
    location = "northeurope"
    resource_group_name = azurerm_resource_group.rg.name
    service_plan_id = azurerm_service_plan.plan_apigateway.id
    site_config {
        always_on = false
        application_stack {
            docker_image_name = "nginx:latest"
        }
    }
}</code></code></pre><p>This resource provisions an <strong>Azure Linux Web App</strong> that acts as the API Gateway.</p><p>Key points:</p><ul><li><p><strong>Hosted on the App Service Plan</strong>: The <code>service_plan_id</code> links the web app to the previously defined App Service Plan.</p></li><li><p><strong>Container-based deployment</strong>: The application runs the <code>nginx:latest</code> Docker image, demonstrating how Azure App Service can host containerized workloads without managing servers.</p></li><li><p><strong>Lightweight configuration</strong>: <code>always_on</code> is disabled, which is appropriate for free-tier or non-production environments.</p></li></ul><p>Using NGINX as the container image makes this setup ideal for:</p><ul><li><p>API routing and reverse proxy scenarios</p></li><li><p>Acting as a lightweight API Gateway</p></li><li><p>Future expansion with custom NGINX configurations or additional containers</p></li></ul><p>Similarly, we need to create additional App Services for <strong>Transaction</strong>, <strong>Balance</strong>, <strong>Transfer</strong>, and <strong>Notification</strong>. Each App Service must be deployed under its <strong>own dedicated App Service Plan</strong>. All required source code is available in the repository for reference.</p><p><a href="https://github.com/iamuttamchaturvedi9/IaCWithTerraform">https://github.com/iamuttamchaturvedi9/IaCWithTerraform</a></p><p>Now let&#8217;s jump into creating DB server and databases</p><pre><code><code># Database transaction
resource  "azurerm_mssql_server" "sql_server_transaction" {
    name = "sqlserver-transaction"
    resource_group_name = azurerm_resource_group.rg.name
    location = "northeurope"
    version = "12.0"
    administrator_login = "adminuser"
    administrator_login_password = "admin.12345"
}
resource  "azurerm_mssql_database" "sql_database_transaction" {
    name = "sqlserver-transaction-northeurope"
    server_id =  azurerm_mssql_server.sql_server_transaction.id
    sku_name = "Basic"
}

# Database balance
resource  "azurerm_mssql_server" "sql_server_balance" {
    name = "sqlserver-balance"
    resource_group_name = azurerm_resource_group.rg.name
    location = "northeurope"
    version = "12.0"
    administrator_login = "adminuser"
    administrator_login_password = "admin.12345"
}

resource  "azurerm_mssql_database" "sql_database_balance" {
    name = "sqlserver-balance-northeurope"
    server_id =  azurerm_mssql_server.sql_server_transaction.id
    sku_name = "Basic"
}</code></code></pre><p>Similarly add above code fro transaction,balance and transfer databases and run terraform plan. Once plan is successful then run apply and say yes while asking for approval. It will create required resources</p><p>Ok now we have created all our resources. Its time to delete resources which cost money . Here we 2 ways to delete resources in terraform .</p><ol><li><p>Using &#8220;terraform destroy &#8220; command</p></li></ol><pre><code><code>tzerraform destroy -target = azurerm_mssql_database.sql_database_transaction</code></code></pre><ol><li><p>Commenting code and running &#8220;terraform plan&#8221; and &#8220;terraform apply&#8221; commands</p></li></ol><pre><code><code># resource  "azurerm_mssql_database" "sql_database_transfer" {
#    name = "sqlserver-transfer-northeurope"
#    server_id =  azurerm_mssql_server.sql_server_transaction.id
#    sku_name = "Basic"
# }</code></code></pre><p>Below command will destroy commented code resources</p><p>terraform plan</p><p>terraform apply</p><p>Final Note: pelase add subscrition id and required varibles values in data.txt</p><pre><code><code>main.tf
provider "azurerm"{
    subscription_id = "&lt;subscription_id&gt;"
    features{
        resource_group{
            prevent_deletion_if_contains_resources = false
        }
    }
}
---------------------------------------------------------------------------------------------------------------------
data.txt

export ARM_SUBSCRIPTION_ID="&lt;your-subscription-id&gt;"
export ARM_TENANT_ID="&lt;your-tenant-id&gt;"
export ARM_CLIENT_ID="&lt;your-client-id&gt;"
export ARM_CLIENT_SECRET="&lt;your-client-secret&gt;"</code></code></pre><h2><strong>Conclusion</strong></h2><p>Terraform makes infrastructure provisioning <strong>repeatable, predictable, and scalable</strong> by turning cloud resources into version-controlled code. By defining Azure components declaratively, you reduce manual effort, minimize configuration drift, and improve consistency across environments. With proper state management and secure authentication (for example, service principals or federated identity instead of user logins), Terraform becomes a reliable foundation for both day-to-day infrastructure changes and automated CI/CD deployments.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.iamuttamchaturvedi.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading CodeCraft Journal! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Azure APIM]]></title><description><![CDATA[User logs are Injected in Application Insight]]></description><link>https://www.iamuttamchaturvedi.com/p/azure-apim</link><guid isPermaLink="false">https://www.iamuttamchaturvedi.com/p/azure-apim</guid><dc:creator><![CDATA[Uttam Chaturvedi]]></dc:creator><pubDate>Thu, 02 Oct 2025 08:58:36 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!ZVTx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZVTx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZVTx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png 424w, https://substackcdn.com/image/fetch/$s_!ZVTx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png 848w, https://substackcdn.com/image/fetch/$s_!ZVTx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png 1272w, https://substackcdn.com/image/fetch/$s_!ZVTx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZVTx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png" width="1100" height="1062" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1062,&quot;width&quot;:1100,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1454147,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://iamuttamchaturvedi.substack.com/i/175044374?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZVTx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png 424w, https://substackcdn.com/image/fetch/$s_!ZVTx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png 848w, https://substackcdn.com/image/fetch/$s_!ZVTx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png 1272w, https://substackcdn.com/image/fetch/$s_!ZVTx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe98d010a-8f69-4171-aa0d-51f84a381b19_1100x1062.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p><strong>Problem Statement</strong></p><p>The current API gateway does not provide user details along with incoming requests. As a result, it is not possible to reliably track which user is accessing specific APIs.</p><p><strong>Solution:</strong><br>We can implement an <strong>inbound policy</strong> in the API Gateway to capture trace information. These traces will be sent to <strong>Application Insights</strong>, where they can be later used to track and analyze user activity. We can also store thes logs to database for future references</p><h1>Intro &#8212; Azure API Management (APIM) gateway (short &amp; practical)</h1><p>Azure API Management (APIM) is a managed gateway that sits in front of your APIs and provides a central place to secure, publish, transform, and observe traffic. With APIM you can:</p><ul><li><p>apply policies (XML fragments) at global, API, or operation level to throttle, rewrite, authenticate, cache, log, or transform requests and responses; <a href="https://learn.microsoft.com/en-us/azure/api-management/api-management-policies?utm_source=chatgpt.com">Microsoft Learn+1</a></p></li><li><p>enrich requests and responses (add headers, inject correlation IDs) so downstream services and telemetry systems can correlate traces; <a href="https://learn.microsoft.com/en-us/azure/api-management/api-management-policy-expressions?utm_source=chatgpt.com">Microsoft Learn+1</a></p></li></ul><p>This makes APIM an ideal place to add lightweight observability (user identity, correlation id, subscription id, client IP) for every incoming call, even when the backend or client doesn&#8217;t supply all the fields you need.</p><h3><strong>Now let&#8217;s dive into required steps to create api gateway, configure it with application insight and add traces.</strong></h3><p>Step by Step Process:</p><ol><li><p>Create Http API with url detail in Gateway and Add operations</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hisn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hisn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg 424w, https://substackcdn.com/image/fetch/$s_!hisn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg 848w, https://substackcdn.com/image/fetch/$s_!hisn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!hisn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hisn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg" width="807" height="317" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:317,&quot;width&quot;:807,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Screenshot 2025-10-01 182856&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Screenshot 2025-10-01 182856" title="Screenshot 2025-10-01 182856" srcset="https://substackcdn.com/image/fetch/$s_!hisn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg 424w, https://substackcdn.com/image/fetch/$s_!hisn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg 848w, https://substackcdn.com/image/fetch/$s_!hisn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!hisn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3956f20c-1839-491d-8bc1-c2028338075d_807x317.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol><li><p>Select the operation inside <strong>All Operation </strong>and click on inbound processing =&gt; Polices (&lt;/&gt;)</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yzRW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yzRW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png 424w, https://substackcdn.com/image/fetch/$s_!yzRW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png 848w, https://substackcdn.com/image/fetch/$s_!yzRW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png 1272w, https://substackcdn.com/image/fetch/$s_!yzRW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yzRW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png" width="1456" height="697" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:697,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;2025-10-01_18h34_38&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="2025-10-01_18h34_38" title="2025-10-01_18h34_38" srcset="https://substackcdn.com/image/fetch/$s_!yzRW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png 424w, https://substackcdn.com/image/fetch/$s_!yzRW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png 848w, https://substackcdn.com/image/fetch/$s_!yzRW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png 1272w, https://substackcdn.com/image/fetch/$s_!yzRW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3283f4c2-1f7a-4f27-82f1-9686b08b9380_2704x1294.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol><li><p>In Inbound polices, once you click (&lt;/&gt;) your can paste code as shown below. Adding this policy will include the email of the user who logged In and forward it to related Application insight of the API .</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5oFq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5oFq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg 424w, https://substackcdn.com/image/fetch/$s_!5oFq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg 848w, https://substackcdn.com/image/fetch/$s_!5oFq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!5oFq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5oFq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg" width="792" height="348" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:348,&quot;width&quot;:792,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Screenshot 2025-10-01 184116&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Screenshot 2025-10-01 184116" title="Screenshot 2025-10-01 184116" srcset="https://substackcdn.com/image/fetch/$s_!5oFq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg 424w, https://substackcdn.com/image/fetch/$s_!5oFq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg 848w, https://substackcdn.com/image/fetch/$s_!5oFq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!5oFq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9d6ac5a-dd5b-4a51-bb16-cbcf299881b8_792x348.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><pre><code><code>&lt;inbound&gt;
    &lt;base /&gt;
    &lt;set-header name=&#8221;user-email&#8221; exists-action=&#8221;override&#8221;&gt;
        &lt;value&gt;@(context.User != null ? context.User.Email : &#8220;unknown&#8221;)&lt;/value&gt;
    &lt;/set-header&gt;
    &lt;trace source=&#8221;APIM&#8221; severity=&#8221;information&#8221;&gt;
        &lt;message&gt;@($&#8221;userEmail:{(context.User != null ? context.User.Email : &#8220;unknown&#8221;)}&#8221;)&lt;/message&gt;
    &lt;/trace&gt;
&lt;/inbound&gt;</code></code></pre><ol start="4"><li><p>In API Settings tab look for Diagnostics Logs =&gt; Application Insights and click on Enable checkbox . In the Destination dropdown select your application insight and save it</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hvpE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hvpE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg 424w, https://substackcdn.com/image/fetch/$s_!hvpE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg 848w, https://substackcdn.com/image/fetch/$s_!hvpE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!hvpE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hvpE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg" width="912" height="547" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:547,&quot;width&quot;:912,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Screenshot 2025-10-01 192453&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Screenshot 2025-10-01 192453" title="Screenshot 2025-10-01 192453" srcset="https://substackcdn.com/image/fetch/$s_!hvpE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg 424w, https://substackcdn.com/image/fetch/$s_!hvpE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg 848w, https://substackcdn.com/image/fetch/$s_!hvpE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!hvpE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c8d6a74-7b31-4570-9cd0-a1e8723cb01f_912x547.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol start="4"><li><p>Navigate to application insight =&gt; Transaction search and look for traces of API request in last 24 hours. In traces you wil find all the details you added in inbound policy</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LuyW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LuyW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg 424w, https://substackcdn.com/image/fetch/$s_!LuyW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg 848w, https://substackcdn.com/image/fetch/$s_!LuyW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!LuyW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LuyW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg" width="505" height="130" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:130,&quot;width&quot;:505,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Screenshot 2025-10-01 191632&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Screenshot 2025-10-01 191632" title="Screenshot 2025-10-01 191632" srcset="https://substackcdn.com/image/fetch/$s_!LuyW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg 424w, https://substackcdn.com/image/fetch/$s_!LuyW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg 848w, https://substackcdn.com/image/fetch/$s_!LuyW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!LuyW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F501a8bc9-680d-44f6-98c1-af7c39d07ba1_505x130.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p><strong>Summary</strong></p><p>In this article, we explored how to extend <strong>Azure API Management (APIM) Gateway</strong> with custom policies to improve <strong>user tracking and observability</strong>.</p><p>By combining <strong>APIM policies</strong> with <strong>Application Insights telemetry</strong>, you create a <strong>robust monitoring setup</strong> that allows you to trace user activity across every API call, troubleshoot issues quickly, and gain better insights into how APIs are being consumed.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.iamuttamchaturvedi.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading CodeCraft Journal! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Azure service principle]]></title><description><![CDATA[When I first encountered the term &#8220;Service Principal&#8221;, I was completely confused.]]></description><link>https://www.iamuttamchaturvedi.com/p/azure-service-principle</link><guid isPermaLink="false">https://www.iamuttamchaturvedi.com/p/azure-service-principle</guid><dc:creator><![CDATA[Uttam Chaturvedi]]></dc:creator><pubDate>Sat, 30 Aug 2025 17:43:34 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!VkhW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VkhW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VkhW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png 424w, https://substackcdn.com/image/fetch/$s_!VkhW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png 848w, https://substackcdn.com/image/fetch/$s_!VkhW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png 1272w, https://substackcdn.com/image/fetch/$s_!VkhW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VkhW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png" width="1024" height="993" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:993,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1464006,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://iamuttamchaturvedi.substack.com/i/172352351?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VkhW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png 424w, https://substackcdn.com/image/fetch/$s_!VkhW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png 848w, https://substackcdn.com/image/fetch/$s_!VkhW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png 1272w, https://substackcdn.com/image/fetch/$s_!VkhW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd86da29-97f5-470b-9512-0eea8b2a9aa0_1024x993.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>When I first encountered the term &#8220;<strong>Service Principal</strong>&#8221;, I was completely confused.<br>Was it a user? Was it an app? Was it a login account?<br>And why did it need its own password or secret key?</p><p>If you&#8217;re getting started with cloud infrastructure, especially in Azure, the concept of a Service Principal can feel vague and overly abstract.</p><p>You&#8217;re not alone &#8212; <strong>many professionals</strong>, especially those coming from traditional development or sysadmin backgrounds, struggle to understand:</p><p>What exactly is a Service Principal?</p><p>When and why should you use one?</p><p>In this post, I&#8217;ll break it down in plain language, using real-world example and code snippets&#8212; so by the end, you&#8217;ll never be confused by the term again.</p><p>Service Principal is like a user account for apps or services that need to access Azure resources. For example in order to login in the system user need user name and password, similarly its kind of user name and password for the app to access resource in azure</p><p><strong>Very Simple Definition:</strong><br>A service principal is a special account that lets an app or automation tool sign in to Azure and do things, like start a virtual machine or deploy code &#8212; but only what you allow it to do.<br>It&#8217;s not a person, but it has its own ID and password (called a client ID and secret), and you can control what it&#8217;s allowed to access using roles and permissions.</p><p><strong>Scenarios</strong>:</p><blockquote><p><em><strong>1. When You Register an Application in Azure AD</strong><br>&#8226; <strong>Scenario</strong>: You create an app registration (e.g., for a web app, API, or daemon service).<br>&#8226; Result: Azure automatically creates a corresponding Service Principal in your tenant.<br>&#8226; Purpose: The app can then authenticate and access resources based on the permissions you assign to the service principal.<br>App Registration = Identity<br>Service Principal = Role-playing identity inside a tenant<br><br><strong>2. When You Create an Azure Resource That Needs to Access Other Resources</strong><br><strong>Examples:</strong><br>&#8226; <strong>Azure Kubernetes Service (AKS)<br></strong>&#8226; <strong>Azure App Service with managed identity<br>. Azure Data Factory with linked services</strong><br>&#8226; <strong>Result</strong>: Azure automatically creates a Managed Identity, which is essentially a Service Principal under the hood.</em></p><p><em><strong>System-assigned managed identity </strong>is tightly coupled with the resource and gets deleted if the resource is deleted.<br><br>3. <strong>When Using Azure DevOps Service Connections</strong><br>&#8226; <strong>Scenario</strong>: You create a Service Connection in Azure DevOps to deploy resources to Azure.<br>&#8226; <strong>Result</strong>: Azure DevOps automatically creates a service principal and assigns it the required permissions (e.g., Contributor role).<br>It&#8217;s best practice to regularly audit these service principals and rotate secrets if not using managed identity.</em></p></blockquote><p><strong>Create a Service Principal with permissions to access a specific Azure subscription or resource group.</strong></p><blockquote><p><em>bash</em></p><p><em>az ad sp create-for-rbac &#8212; name &#8220;terraform-deployer&#8221; &#8212; role=&#8221;Contributor&#8221; &#8212; scopes=&#8221;/subscriptions/&lt;subscription-id&gt;/resourceGroups/&lt;resource-group-name&gt;&#8221;</em></p><p><em>This command outputs:json<br>CopyEdit<br>{<br>&#8220;appId&#8221;: &#8220;xxxxx-xxxx-xxxx-xxxx&#8221;,<br>&#8220;displayName&#8221;: &#8220;terraform-deployer&#8221;,<br>&#8220;password&#8221;: &#8220;xxxxxxx&#8221;,<br>&#8220;tenant&#8221;: &#8220;xxxxx-xxxxx&#8221;<br>}<br>These credentials are saved as secrets in your CI/CD pipeline.</em></p><p><em>2. Configure Terraform with the Service Principal:<br>In your pipeline or terminal, set these environment variables:</em></p><p><em>bash<br>CopyEdit<br>export ARM_CLIENT_ID=xxxxx-xxxx<br>export ARM_CLIENT_SECRET=xxxxxxx<br>export ARM_SUBSCRIPTION_ID=xxxxx-xxxx<br>export ARM_TENANT_ID=xxxxx-xxxx<br>Now, Terraform can authenticate to Azure securely and automatically using the Service Principal</em></p></blockquote><p><strong>Summary</strong><br>Using a Service Principal (either directly or via Managed Identity) is a secure and scalable way to let your Azure applications access other Azure resources &#8212; like Key Vault, Storage, or SQL &#8212; without using hardcoded credentials. This approach enhances security, supports automation, and aligns with DevSecOps best practices</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.iamuttamchaturvedi.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Uttam&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Terraform Introduction]]></title><description><![CDATA[Terraform is an open-source IaC (Infrastructure-as-Code) tool for configuring and deploying cloud infrastructure.]]></description><link>https://www.iamuttamchaturvedi.com/p/terraform-introduction</link><guid isPermaLink="false">https://www.iamuttamchaturvedi.com/p/terraform-introduction</guid><dc:creator><![CDATA[Uttam Chaturvedi]]></dc:creator><pubDate>Sat, 30 Aug 2025 17:30:08 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!a4vQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!a4vQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!a4vQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp 424w, https://substackcdn.com/image/fetch/$s_!a4vQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp 848w, https://substackcdn.com/image/fetch/$s_!a4vQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp 1272w, https://substackcdn.com/image/fetch/$s_!a4vQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!a4vQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp" width="1456" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31140,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://iamuttamchaturvedi.substack.com/i/172351805?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!a4vQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp 424w, https://substackcdn.com/image/fetch/$s_!a4vQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp 848w, https://substackcdn.com/image/fetch/$s_!a4vQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp 1272w, https://substackcdn.com/image/fetch/$s_!a4vQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8890638-a846-4f2e-a1fe-46853468ea7f_1643x812.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>Terraform is an open-source IaC (Infrastructure-as-Code) tool for configuring and deploying cloud infrastructure. It codifies infrastructure in configuration files that describe the desired state for your topology. Terraform allows you to use a consistent workflow over your infrastructure lifecycle, regardless of the resource provider. The infrastructure as code workflow lets your declaratively manage a variety of services and automate your changes to them, reducing the risk of human error through manual operations.</p><p>Advantages:</p><ol><li><p>IAC is crucial because it helps to speed deployment and release of software</p></li><li><p>Terraforms support provide multi-cloud platforms like AWS, AZURE and Google etc..</p></li><li><p>IAC assist to restrict user to delete resources accidentally</p></li><li><p>Provide template to write code and use it many times</p></li><li><p>Unified template also provide security</p></li></ol><p></p><ul><li><p><strong>Workflows</strong></p></li></ul><ol><li><p>In HCP Terraform, your resources are organized by workspaces, which contain your resource definitions, environment and input variables, and state files. A Terraform operation occurs within a workspace, and Terraform uses the configuration and state for that workspace to modify your infrastructure.</p></li><li><p>HCP Terraform supports three workflows for your Terraform runs:</p></li></ol><ul><li><p>The CLI-driven workflow, which uses Terraforms standard CLI tools to execute runs in HCP Terraform.</p></li><li><p>The UI/Version Control System(VCS)-driven workflow, in which changes pushed to version control repositories trigger runs in the associated workspace.</p></li><li><p>The API-driven workflow, which allows you to create tooling to interact with the HCP Terraform API programmatically</p></li></ul><p>Terraform Basic command:</p><p>Init : Validate working directory consisting of terraform config file. This is the first command to be executed after writing new file</p><p>Validate: Check for syntax and validate config file</p><p>Plan: Create execution plan</p><p>Apply: Apply changes and execute command to create resources</p><p>Destroy: Remove terraform managed resources. It will ask for confirmation before removing resources</p><p><strong>Terraform Module Definition</strong></p><p>A Terraform module is a container for multiple resources that are used together.</p><p>A module can be as simple as a single resource or as complex as a complete infrastructure stack.</p><p>Modules provide a modular structure with a clear separation of concerns, making infrastructure easier to manage, reuse, and maintain.</p><p><strong>Example: Deploying a Resource Group with Terraform Modules</strong></p><p>In this example, we use Terraform modules to deploy a Resource Group.<br>The project repository for the Resource Group creation is available here:<br><a href="https://github.com/uttamchaturvedi9/terraformforcommunity">https://github.com/uttamchaturvedi9/terraformforcommunity</a></p><p>&#9500;&#9472;&#9472; main.tf # Main Terraform configuration<br>&#9500;&#9472;&#9472; variables.tf # Variable definitions<br>&#9500;&#9472;&#9472; terraform.tfvars # variable values<br>&#9500;&#9472;&#9472; modules/ # Terraform modules<br>&#9474; &#9492;&#9472;&#9472; resource-group/ # Resource Group module<br>&#9474; &#9500;&#9472;&#9472; main.tf # Module main configuration<br>&#9474; &#9500;&#9472;&#9472; variables.tf # Module variables<br>&#9474; &#9492;&#9472;&#9472; outputs.tf # Module outputs<br>&#9492;&#9472;&#9472; README.md # This file</p><p>This repository demonstrates how to:</p><p>Define a Terraform module for Resource Group creation.</p><p>Use input variables for flexibility.</p><p>Apply modular structure for better reusability.</p><p><strong>Summary</strong><br>Terraform, as an Infrastructure as Code (IAC) tool, allows infrastructure provisioning and management through declarative configuration files. By defining resources in reusable modules, teams achieve:</p><p><strong>Consistency</strong>: Repeatable deployments across environments.</p><p><strong>Modularity</strong> : Clear separation of concerns, making code reusable and maintainable.</p><p><strong>Scalability</strong>: Ability to orchestrate simple to complex infrastructure stacks.</p><p><strong>Collaboration</strong>: Version-controlled infrastructure code shared across teams.</p><p><strong>Conclusion</strong><br>Using Terraform as IAC empowers organizations to manage infrastructure in the same way they manage application code. This approach reduces manual effort, minimizes errors, and accelerates delivery. With its modular design, state management, and provider ecosystem, Terraform provides a scalable, reliable, and automated way to orchestrate infrastructure, making it a cornerstone of modern DevOps practices.</p><p>Running code can be found here:</p><p>https://github.com/uttamchaturvedi9/terraformforcommunity</p>]]></content:encoded></item><item><title><![CDATA[Azuer SAS Tokens]]></title><description><![CDATA[Problem Statement]]></description><link>https://www.iamuttamchaturvedi.com/p/azuer-sas-tokens</link><guid isPermaLink="false">https://www.iamuttamchaturvedi.com/p/azuer-sas-tokens</guid><dc:creator><![CDATA[Uttam Chaturvedi]]></dc:creator><pubDate>Sat, 30 Aug 2025 17:19:46 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!iapm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iapm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iapm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!iapm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!iapm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!iapm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iapm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png" width="1024" height="1024" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1024,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:893087,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://iamuttamchaturvedi.substack.com/i/172351154?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iapm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png 424w, https://substackcdn.com/image/fetch/$s_!iapm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png 848w, https://substackcdn.com/image/fetch/$s_!iapm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!iapm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc88ac034-419a-497e-8b77-efa887f2bf53_1024x1024.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2><strong>Problem Statement</strong></h2><p>An HTML file stored in <strong>Azure Blob Storage</strong> was <strong>not accessible</strong> when opened as a direct link.</p><h2><strong>The following issues were encountered:</strong></h2><ul><li><p>Without authentication, the blob was private and returned <strong>Authorization errors</strong>.</p></li><li><p>When accessed via a generated SAS token, the browser attempted to <strong>download the file</strong> instead of rendering it as an HTML page.</p></li><li><p>Direct access using a blob endpoint was not possible for users inside the network without special permissions.</p></li></ul><p>The requirement was to make the file <strong>viewable in a browser as a web page</strong> via a shareable link while still controlling access.</p><p><strong>The soultion is SAS tokens</strong></p><p>After investigation, the following steps were taken to make the file accessible through a SAS token and open correctly in the browser.</p><p>Generate a SAS Token for the Blob</p><p>A Shared Access Signature (SAS) token grants time-limited and permission-scoped access to a specific blob without exposing the storage account key.</p><p><strong>Steps (Azure Portal):</strong></p><ol><li><p><em>Navigate to the <strong>Azure Storage Account</strong> in the Azure Portal.</em></p></li><li><p><em>Go to <strong>Containers</strong> &#8594; open the target container (e.g., </em><code>invetoryreport</code><em>).</em></p></li><li><p><em>Locate and click on the HTML file (e.g., </em><code>/stockdata/invetoryreport.html</code><em>).</em></p></li><li><p><em>Click <strong>Generate SAS</strong> at the top.</em></p></li><li><p><em>Configure:</em></p></li></ol><ul><li><p><em><strong>Permissions</strong>: Read (</em><code>r</code><em>)</em></p></li><li><p><em><strong>Start time</strong>: A few minutes earlier than the current time (to avoid clock skew issues)</em></p></li><li><p><em><strong>Expiry time</strong>: As per requirement (e.g., 1 day or 1 week)</em></p></li><li><p><em><strong>Allowed protocol</strong>: HTTPS</em></p></li><li><p><em>(Optional) <strong>Allowed IP addresses</strong>: Specify if restricting to certain networks</em></p></li></ul><p><em>6. Click <strong>Generate SAS token and URL</strong>.</em></p><p><em>7. Copy the <strong>Blob SAS URL</strong> provided. This URL contains the file path and SAS token parameters.</em></p><h2><strong>Set Correct Content-Type for the Blob</strong></h2><p>By default, blobs may be served with the <code>application/octet-stream</code> MIME type, which forces browsers to download them. To make an HTML file render in a browser, the <code>Content-Type</code> must be set to <code>text/html</code>.</p><p><strong>Steps (Azure Portal):</strong></p><ol><li><p><em>In the blob&#8217;s details page, click <strong>Properties</strong>.</em></p></li><li><p><em>Locate the <strong>Content-Type</strong> field.</em></p></li><li><p><em>Change the value to </em><code>text/html</code></p></li><li><p><em>Save the changes.</em></p></li></ol><p>Congratulations!!!! . Now you can access file directly in browser</p><p><strong>Advantages of SAS Tokens</strong></p><ol><li><p><strong>Granular Access Control </strong>You can grant access to specific resources (containers, blobs, queues, tables, files) without giving full account keys. Permissions can be fine-tuned (read, write, delete, list, etc.).</p></li><li><p><strong>Time-Bound Access</strong>Tokens can expire automatically, reducing the risk of long-term exposure.</p></li><li><p><strong>No Need to Share Account Keys </strong>Account keys give full access; a SAS token limits scope and reduces potential damage if compromised.</p></li><li><p><strong>Temporary &amp; Revocable </strong>You can revoke access by regenerating the storage account keys or changing stored policies.</p></li><li><p><strong>Flexible Delivery </strong>Tokens can be passed via URLs, making them easy to use in applications, scripts, and APIs without extra authentication steps.</p></li></ol><h2><strong>Disadvantages of SAS Tokens</strong></h2><ol><li><p><strong>Security Risk if Leaked </strong>Anyone with the SAS URL has the permissions until it expires &#8212; so tokens must be protected like passwords.</p></li><li><p><strong>Difficult to Revoke Before Expiry </strong>For <strong>ad hoc SAS tokens</strong> (not tied to a stored access policy), you can&#8217;t revoke them without rotating the storage account key.</p></li><li><p><strong>Potential for Over-Permissioning </strong>If not configured carefully, a token might allow more actions than intended.</p></li><li><p><strong>Expiration Management </strong>Short expiry improves security but can cause operational issues if the token expires mid-process; long expiry increases risk if leaked.</p></li><li><p><strong>Logging Limitations </strong>You can see when storage is accessed, but you can&#8217;t easily trace the identity of the person using the token &#8212; it&#8217;s just whoever has it.</p></li></ol><p>&#128161; <strong>Best Practice:</strong></p><ul><li><p>Use <strong>stored access policies</strong> where possible &#8212; they let you revoke a SAS without touching account keys.</p></li><li><p>Always use <strong>HTTPS</strong> to prevent token sniffing.</p></li><li><p>Keep SAS lifetimes short and permissions minimal.</p></li></ul>]]></content:encoded></item></channel></rss>