<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cloudlabs on Medium]]></title>
        <description><![CDATA[Stories by Cloudlabs on Medium]]></description>
        <link>https://medium.com/@cloudlabs01?source=rss-f39c611d1a39------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GGKJu83Qk4uAJKHS.jpg</url>
            <title>Stories by Cloudlabs on Medium</title>
            <link>https://medium.com/@cloudlabs01?source=rss-f39c611d1a39------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 30 May 2026 16:47:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cloudlabs01/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Restrict Azure User Access Administrator with ABAC]]></title>
            <link>https://medium.com/@cloudlabs01/restrict-azure-user-access-administrator-with-abac-62fe4eff8ee9?source=rss-f39c611d1a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/62fe4eff8ee9</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-rbac]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloud-security]]></category>
            <dc:creator><![CDATA[Cloudlabs]]></dc:creator>
            <pubDate>Sat, 16 May 2026 18:02:42 GMT</pubDate>
            <atom:updated>2026-05-16T18:02:42.097Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*TfMF9U3B48ursywpbvUKkA.png" /></figure><p>An Azure access-control pattern that uses RBAC and ABAC conditions to restrict and govern the highly privileged User Access Administrator role.</p><h3>Why this matters</h3><p>The User Access Administrator role can manage role assignments, including the ability to grant elevated permissions. Without guardrails, it becomes a high-risk privilege for service principals and users.</p><p>A compromised or misconfigured principal can use this role to assign sensitive roles like <strong>Owner</strong> and take over the environment.</p><h3>The problem</h3><p>A broad role assignment like this gives a principal full access to manage subscriptions:</p><pre>resource &quot;azurerm_role_assignment&quot; &quot;owner&quot; {<br>  scope                = data.azurerm_subscription.current.id<br>  role_definition_name = &quot;Owner&quot;<br>  principal_id         = var.user_principal_id<br>}</pre><h3>The solution</h3><p>Use Azure ABAC (Attribute-Based Access Control) conditions on the User Access Administrator role assignment to block specific role definitions from being granted.</p><p>This approach helps:</p><ul><li>Prevent unauthorized elevation of access</li><li>Reduce the blast radius of compromised principals</li><li>Keep role assignment permissions under control</li></ul><pre>resource &quot;azurerm_role_assignment&quot; &quot;role&quot; {<br>  role_definition_name = &quot;User Access Administrator&quot;<br>  scope                = data.azurerm_subscription.current.id<br>  principal_id         = var.user_principal_id<br>  principal_type       = &quot;ServicePrincipal&quot;<br>  description          = &quot;Role Based Access Control Administrator<br>                          role assignment with ABAC condition.&quot;<br>  condition_version    = &quot;2.0&quot;<br>  condition            = &lt;&lt;-EOT<br> (<br>  !(<br>    @Resource[Microsoft.Authorization/<br>      roleAssignments:RoleDefinitionId]<br>    ForAnyOfAnyValues:GuidEquals {<br>      8e3af657-a8ff-443c-a75c-2fe8c4bcb635,<br>      b24988ac-6180-42a0-ab88-20f7382dd24c<br>    }<br>  )<br> )<br>EOT<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*GPE5ISRPrtg2GVRkLeAOPA.png" /></figure><p>Blocked Role IDs:</p><pre>8e3af657-a8ff-443c-a75c-2fe8c4bcb635- Owner <br>b24988ac-6180-42a0-ab88-20f7382dd24c - Contributor</pre><p>This is not only limited to role assignments, this can be extended controlling access to blobs</p><h3>Key takeaway</h3><p>Protect high-risk role assignments by adding fine-grained ABAC conditions instead of granting broad privileges unconditionally.</p><h3>Reference:</h3><p><a href="https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment#example-usage-abac-condition">Azure Terraform Resource</a></p><p><a href="https://learn.microsoft.com/en-us/azure/role-based-access-control/conditions-role-assignments-portal">Azure Role Assignments conditions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62fe4eff8ee9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to pass list data type as parameter in the Azure pipelines]]></title>
            <link>https://medium.com/@cloudlabs01/how-to-pass-list-data-type-as-parameter-in-the-azure-pipelines-fafb4ed17b17?source=rss-f39c611d1a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/fafb4ed17b17</guid>
            <category><![CDATA[azure-devops-pipeline]]></category>
            <category><![CDATA[pipeline-as-code]]></category>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Cloudlabs]]></dc:creator>
            <pubDate>Sat, 09 Mar 2024 15:47:28 GMT</pubDate>
            <atom:updated>2024-03-09T15:47:28.701Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*JYuuF_I0AHnucSp7ielBNA.jpeg" /><figcaption>Azure Pipelines</figcaption></figure><p>In this article we will explore how to pass the list of strings as parameters in the Azure Pipelines.</p><p>Azure Pipelines data types can be strings, boolean , objects and steps. Refer the <a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/process/template-parameters?view=azure-devops#parameter-data-types">link</a> for different types of data types can be used.</p><p>By default , there is no direct way to pass list of strings in the pipelines. In this example we will pass list of strings as object , using <strong>Join</strong> function we will join all the strings with separator and save it as pipeline variable.</p><p>In the pipeline script, we will call this pipeline variable to run the jobs / steps.</p><p>Below bash example using for loop to print the list of strings that we passed in the pipeline parameters.</p><pre>name: array-datatype-pipeline<br><br>trigger: none<br><br>pool: Default<br><br>parameters:<br>- name: myArray<br>  type: object<br>  default:<br>    - FOO<br>    - BAR<br>    - ZOO<br><br>variables:<br>- name: arrayobj<br>  value: ${{ join(&#39;;&#39;,parameters.myArray) }} # joins the object into semi-column seperate strings. <br><br>steps:<br>  - task: Bash@3<br>    displayName: echo array_test<br>    name: array_test<br>    inputs:<br>      targetType: &#39;inline&#39;<br>      script: |<br>          my_array=&#39;${{ variables.arrayobj }}&#39;<br>          echo &quot;echo my_array&quot;<br>          echo $my_array # FOO;BAR;ZOO<br>          newarray=$(echo $my_array| tr &#39;;&#39; &#39;\t&#39;) # Bash array needs strings with spaces.<br>          echo $newarray # FOO BAR ZOO<br>          for value in ${newarray[@]}<br>            do<br>              echo &quot;Value for fruits array is: $value&quot;<br>            done<br>             # Value for fruits array is FOO<br>             # Value for fruits array is BAR<br>             # Value for fruits array is ZOO</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*vUEJvMPyU6zBmpnP2nbPwg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fafb4ed17b17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terratest - Infrastructure Automated Testing]]></title>
            <link>https://medium.com/@cloudlabs01/infrastructure-automate-testing-9cd95cf553be?source=rss-f39c611d1a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cd95cf553be</guid>
            <category><![CDATA[terratest]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[automate-testing]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Cloudlabs]]></dc:creator>
            <pubDate>Mon, 02 May 2022 00:32:17 GMT</pubDate>
            <atom:updated>2022-05-03T19:29:47.634Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to use Terratest for infrastructure testing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*OXVOgv_jLFDNtPSNBKwADA.png" /><figcaption>Terratest</figcaption></figure><h3>Overview :</h3><p>In this post, we will explore how to use Automated Infrastructure Testing and how it can be easily set up and run basic tests quickly.</p><p>For All new releases, Terraform modules need tested properly and to be foolproof, and this makes Automated Infrastructure Testing is becoming critical to our requirements.</p><p>I was looking for multiple tools for testing such as <a href="https://github.com/inspec/inspec">inspec</a> , <a href="https://github.com/bats-core/bats-core">Bats</a>, and Terratest.</p><p><a href="https://terratest.gruntwork.io/docs/getting-started/introduction/">Terratest </a>is developed by Gruntwork, so it is much close to Terraform and I decided to try Terratest.</p><p>When I read articles about Terratest, it is all written in GO, I just know GO is another programming language, Do I need another language ?? But in the DevOps nothing is constant, every day is new learning .. so I started learning the Go Fundamentals. I just learned how to write simple hello_world.go and read the GO scripts. Refer to the Microsoft Learn <a href="https://docs.microsoft.com/en-us/learn/paths/go-first-steps/">Link</a> for Go Fundamentals.</p><p>Next, I downloaded the sample scripts from Terratest Repo, refer the links mentioned at the end for reference, and try to understand them</p><p>Key takeaways for Terratest Scripts.</p><ol><li>You need GO binary installed in the machine.</li><li>Test scripts naming convention.</li><li>Test scripts Execution</li></ol><p>We will see each step in detail below,</p><ol><li>Go Binary installation.</li></ol><p>Go can be installed as simple as any application installation based on your Operating system.</p><p>while running automated tests, Terratest will download multiple packages for testing.</p><p>Due to resource constraints, I always prefer to run in containers so they can be portable and shared.</p><p>As we need Terraform and other basic tools, i created my own Docker image for this, Refer to my <a href="https://github.com/kgopi2105/terratest-poc">repo</a> for Dockerfile I used for Terratest.</p><p>2. Test script naming convention.</p><p>Terratest uses the GO Testing library, hence all test scripts should end with _test.go ex: terraform_sampleRG_test.go</p><p>3. Execution Steps</p><p>Create two directories in your system,</p><ol><li>one for your Terraform code which needs to test.</li><li>test scripts. Refer to my <a href="https://github.com/kgopi2105/terratest-poc">Repo</a> for a sample test script.</li></ol><p>from the test directory run the <strong>go test -v</strong></p><p>When you run the go test -v command, Go will perform steps as mentioned in the below flowchart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*Wef34h-RdOPc7H0GnpT26Q.png" /></figure><p>In my terraform script, I’m creating Azure Resource Group and outputs ResoureGroup name and Location.</p><p>My test script expects Resource Group&#39;s name as “testrg” and location is “north europe”.</p><p>If both results are matched then the test will be passed else it would fail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*jNSRRjxXOVTwkbtrvQgtww.png" /><figcaption>Terratest Passed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*eIBX__IUWpl7xUEgVEEF_w.png" /><figcaption>Failure Status</figcaption></figure><p>By this, we can develop automated testing scripts for our modules. Terratest is not only for Terraform, it can be used for Dockers, Kubernetes, Packer, and Helm.</p><p>Reference:</p><p>Github Repo — <a href="https://github.com/kgopi2105/terratest-poc">https://github.com/kgopi2105/terratest-poc</a></p><p>Terratest YouTube <a href="https://www.youtube.com/watch?v=xhHOW0EF5u8">video</a></p><p>GO Fundamentals — <a href="https://docs.microsoft.com/en-us/learn/paths/go-first-steps/">https://docs.microsoft.com/en-us/learn/paths/go-first-steps/</a></p><p>Terratest Repo: — <a href="https://github.com/gruntwork-io/terratest">https://github.com/gruntwork-io/terratest</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cd95cf553be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Pre-Commit Hooks]]></title>
            <link>https://medium.com/@cloudlabs01/git-pre-commit-hooks-955774c92c36?source=rss-f39c611d1a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/955774c92c36</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Cloudlabs]]></dc:creator>
            <pubDate>Fri, 25 Feb 2022 20:10:45 GMT</pubDate>
            <atom:updated>2022-02-25T20:26:58.562Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PBsj6MDKeFYsqFXVr8-9og.jpeg" /><figcaption>Git pre-commit hook</figcaption></figure><h3>What are pre-commit hooks ?</h3><p>As the name suggests, these hooks (scripts) will run before we make any commits to our git repository.</p><p>This helps us to run any pre-requests tasks that need to completed/enforced for every commit.</p><p>The best example of pre-commit hooks is Linting and validation.</p><h3>Installation :</h3><p>Pre-commit can be installed using pip .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*eaoBxvUnd9WLAATOY0GDfQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*7rzVff2vMs219hgVrUNUsg.png" /><figcaption>verify application installation</figcaption></figure><p>For Mac / other methods of installation.</p><p><a href="https://pre-commit.com/#install">pre-commit</a></p><h3>Configuration:</h3><p>To make pre-commit hooks work with the git repository,we need to configure the pre-commit configuration file.</p><ol><li>Install pre-commit hook for the repository.</li></ol><p>pre-comit install</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*wxHQ37vJ_KDXwbAPjXqYfQ.png" /></figure><p>This will create necessary hooks (scripts) in the repository, so whenever we make commits it will run the pre-commit hooks and perform the required action .</p><h3>Terraform pre-commit hooks:</h3><p>Till now, we have installed a pre-commit plugin in our system and configured the pre-commit hooks in our repository.</p><p>There is a number of hooks available for many different languages.</p><p>Create a file called .<strong><em>pre-commit-config.yaml</em></strong> and add plugins based on your language.</p><p>Here we going to add the plugins for Terraform .</p><p>Terraform-fmt is for formatting terraform files .</p><p>Terraform-validate is for validating terraform configuration files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dC4Sa17A3-p_0wWTqxTWsQ.png" /></figure><p>Once you added the <em>pre-commit-config.yaml</em> in the repo, before making any commits, these hooks will run and test getting passed.</p><p>In the below screenshot, where we added sample tf file and tried to commit to repo, it got failed due to <strong>terraform fmt</strong> test is failed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*I85I4_j8pe3ogYtIVVGCqQ.png" /></figure><p>Refer the below video for detailed steps for installation / running the hooks.</p><p><a href="https://asciinema.org/a/vADMFzaR9XjCLCZWwLHF9X6YL">How-to-use-git-precommit</a></p><p>By this, we can add multiple hooks based on repo/programming languages used.</p><p>you can refer the sample configuration in the below repo : <a href="https://github.com/kgopi2105/gh-precommit-example">https://github.com/kgopi2105/gh-precommit-example</a></p><p>For further details, please check <a href="https://pre-commit.com/hooks.html">https://pre-commit.com/hooks.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=955774c92c36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Azure Self hosted Agent in Azure Container Instance(ACI)]]></title>
            <link>https://medium.com/@cloudlabs01/running-azure-self-hosted-agent-in-azure-container-instance-aci-ad1fa338d769?source=rss-f39c611d1a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad1fa338d769</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[azure-devops]]></category>
            <dc:creator><![CDATA[Cloudlabs]]></dc:creator>
            <pubDate>Sun, 15 Aug 2021 00:21:18 GMT</pubDate>
            <atom:updated>2021-08-15T00:30:11.541Z</atom:updated>
            <content:encoded><![CDATA[<h4>Overview :</h4><p>In this post , we will setup the Azure DevOps (ADO) Self hosted agent in Azure Container Instance with private ip address.</p><p>In order to do post provisioning or any requirements to run the pipelines from within internal network , we need to setup self hosted agents .</p><p>Traditionally , we deploy the Virtual machine or VM Scale set and run the self hosted agent , Running the VM or VMSS is costlier and takes time to setup .</p><p>Hence we running self hosted agent in Docker Container .</p><p>More information about the Self hosted agent : <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&amp;tabs=browser#install">Link</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*b7eRx-x2HeK_qokWvhX38Q.png" /></figure><p><strong>Pre-Request :</strong></p><ol><li>Azure Self hosted Agent Docker file.</li><li>Azure Devops Project</li><li>Azure Subscription</li></ol><p><strong>1.Azure Self hosted Agent Docker file.</strong></p><p>Before we start setting ACI , we need to build the ADO agent image and push to image registry , we can use either docker hub or Azure container image registry for storing our images.</p><p>Refer the my Github <a href="https://github.com/kgopi2105/ado-selfhosted-aci/tree/main/adoagent">link</a> for building the docker image and push the image to container image registry .</p><p><strong>2. Azure Devops Project</strong></p><p>We need the Azure Devops project to host our selfhosted agent , Agent should be in the same project as your pipelines created.</p><p>Next , generate the Personal Access Tokens with Scope as Build <strong><em>Read&amp;Manage </em></strong><em>permissions</em><strong><em> </em></strong>as shown in the project , using this token our agent will communicate with pipelines to run the jobs .</p><p>Upload the below values in your key vault , our Container Instance Group will read the values from key vault when container is starting.</p><p>AZP-URL = <a href="https://dev.azure.com/kgopi10356">https://dev.azure.com/</a>&lt;projectname&gt;</p><p>AZP-TOKEN = &lt;value generated above step (pat token))</p><p>AZP-AGENT-NAME = azselfhostedagent</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*6gRt4OlRh-ueT3DJmas4WQ.png" /></figure><p><strong>3. Azure Subscription :</strong></p><p>Azure subscription in which we need deploy the self hosted agent.</p><p>it would be good create the Azure Key Vault and upload the values captured in the step 2 in key valut secrets</p><p><strong>Setting up the Azure Container Instance(ACI):</strong></p><p>Now we ready with Docker image , Tokens to run the self hosted agent , you can test your agent within your docker deskop envionment .</p><p><em>docker run -e AZP_URL=&lt;Azure DevOps instance&gt; -e AZP_TOKEN=&lt;PAT token&gt; -e AZP_AGENT_NAME=mydockeragent dockeragent:latest</em></p><p>once your docker container is running succesfully , you can see the agent registered in your project.</p><p>Next , run the Terraform module to provision the Azure container instance within your VNET .</p><p>Note ACI can be provisioned within your subnet by performing subnet delgation to “Microsoft.ContainerInstance/containerGroups”.</p><p>There are few limitations in running ACI within subnet , please refer <a href="https://docs.microsoft.com/en-gb/azure/container-instances/container-instances-virtual-network-concepts#other-limitations">Link</a> for more details about it.</p><p>Once you succesfully provisioned ACI , this image will be registered in the Azure Devops project.</p><p>Git Repo:</p><p>Iac , Pipelines and Dockerfiles used in the project is available in the Github Repo: <a href="https://github.com/kgopi2105/ado-selfhosted-aci">Link</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SEG5ZADs51h_S2ArqUDcqg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad1fa338d769" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>