<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Azure on Wesley Camargo</title><link>http://www.wesleycamargo.com/tags/azure/</link><description>Recent content in Azure on Wesley Camargo</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Thu, 15 Feb 2024 15:41:21 +0000</lastBuildDate><atom:link href="http://www.wesleycamargo.com/tags/azure/index.xml" rel="self" type="application/rss+xml"/><item><title>How to Import an Existing Azure Resource into Your Terraform State with Azure Storage Backend</title><link>http://www.wesleycamargo.com/p/azure-terraform-import/</link><pubDate>Thu, 15 Feb 2024 15:41:21 +0000</pubDate><guid>http://www.wesleycamargo.com/p/azure-terraform-import/</guid><description>&lt;img src="http://www.wesleycamargo.com/p/azure-terraform-import/cover.jpg" alt="Featured image of post How to Import an Existing Azure Resource into Your Terraform State with Azure Storage Backend" />&lt;p>Have you ever for any reason didn&amp;rsquo;t had your Azure resource under Terraform and want to starting managing it by the HashCorp Tool? In this step-by-step guide, we&amp;rsquo;ll walk you through the process of importing an existing Azure resource into your Terraform state file, where your backend is configured to use an Azure Storage Account.&lt;/p>
&lt;h2 id="preparing-the-backend-creating-the-storage-account-for-state-management">Preparing the Backend: Creating the Storage Account for State Management
&lt;/h2>&lt;p>Before we start, we need to set up an Azure Storage Account, which will be the backend for your Terraform state files. This ensures that your state is kept in a secure, centralized location, making it easier to manage, especially when working within a team.&lt;/p>
&lt;p>The Azure CLI script below will create a Resource Group and a Storage Account with the container, where the state files will be created later:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">az group create -l uksouth -n rg-tfstate
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">az storage account create -n sttfstateimport -g rg-tfstate
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">az storage container create -n tfstate --account-name sttfstateimport
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="preparation-of-the-terraform-file">Preparation of the Terraform File
&lt;/h2>&lt;p>Now that our Azure backend ready, lets configure the Terraform files to use it.&lt;/p>
&lt;p>We will first add the &lt;code>azurerm&lt;/code> backend, to do so, we will need to provide the the details from the storage account created previously, it will be required the storage account name, container name, the resource group, and the key of our workload. After that, we will create a simple resource group:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;span class="lnt">14
&lt;/span>&lt;span class="lnt">15
&lt;/span>&lt;span class="lnt">16
&lt;/span>&lt;span class="lnt">17
&lt;/span>&lt;span class="lnt">18
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-hcl" data-lang="hcl">&lt;span class="line">&lt;span class="cl">&lt;span class="k">provider&lt;/span> &lt;span class="s2">&amp;#34;azurerm&amp;#34;&lt;/span> {
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">features&lt;/span> {}
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">}
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">terraform&lt;/span> {
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">backend&lt;/span> &lt;span class="s2">&amp;#34;azurerm&amp;#34;&lt;/span> {
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> container_name&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;tfstate&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> key&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;myworkload&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> resource_group_name&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;rg-tfstate&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> storage_account_name&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;sttfstateimport&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> }
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">}&lt;span class="c1">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Create a resource group
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">&lt;/span>&lt;span class="k">resource&lt;/span> &lt;span class="s2">&amp;#34;azurerm_resource_group&amp;#34; &amp;#34;example&amp;#34;&lt;/span> {
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> name&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;rg-myresourcegroup&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> location&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;UKSouth&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Initialize the Terraform workspace and apply the changes:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">terraform init&lt;span class="p">;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">terraform apply&lt;span class="p">;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="terraform-state-file">Terraform State file
&lt;/h3>&lt;p>After the creation of this resource, lets check the state file hosted on our storage account. Note that we only have the resource group being managed by Terraform.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;span class="lnt">14
&lt;/span>&lt;span class="lnt">15
&lt;/span>&lt;span class="lnt">16
&lt;/span>&lt;span class="lnt">17
&lt;/span>&lt;span class="lnt">18
&lt;/span>&lt;span class="lnt">19
&lt;/span>&lt;span class="lnt">20
&lt;/span>&lt;span class="lnt">21
&lt;/span>&lt;span class="lnt">22
&lt;/span>&lt;span class="lnt">23
&lt;/span>&lt;span class="lnt">24
&lt;/span>&lt;span class="lnt">25
&lt;/span>&lt;span class="lnt">26
&lt;/span>&lt;span class="lnt">27
&lt;/span>&lt;span class="lnt">28
&lt;/span>&lt;span class="lnt">29
&lt;/span>&lt;span class="lnt">30
&lt;/span>&lt;span class="lnt">31
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-json" data-lang="json">&lt;span class="line">&lt;span class="cl">&lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;version&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">4&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;terraform_version&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;1.6.5&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;serial&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">5&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;lineage&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;f5c71b49-ac3a-e0ec-2529-b017b3c3965f&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;outputs&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;resources&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;mode&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;managed&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;type&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;azurerm_resource_group&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;name&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;example&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;provider&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;provider[\&amp;#34;registry.terraform.io/hashicorp/azurerm\&amp;#34;]&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;instances&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;schema_version&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">0&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;attributes&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;id&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;/subscriptions/337ba254-3aa0-4551-ba8e-89debefaa373/resourceGroups/rg-myresourcegroup&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;location&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;uksouth&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;managed_by&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;name&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;rg-myresourcegroup&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;tags&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;timeouts&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">null&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;sensitive_attributes&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;private&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;xxxx&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;check_results&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">null&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="creation-of-resource-outside-terraform-using-azure-cli">Creation of Resource Outside Terraform Using Azure CLI
&lt;/h2>&lt;p>Sometimes, resources are created outside of Terraform, maybe manually or through scripts, or they might even be there before we start to adopt an Infra as Code strategy. In our case we will simulate it using Azure CLI. Create the Azure resource you want to manage with Terraform. For example, you can create a storage account, VM, or any other resource.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">az storage account create -n sttoimport -g rg-myresourcegroup
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>After the resource creation, note the id of the resource. It will be needed later for the import process.&lt;/p>
&lt;h2 id="the-import-process-on-terraform">The Import Process on Terraform
&lt;/h2>&lt;p>Now that we have our resource and the Terraform backend is ready, we can import the existing resource into the Terraform state&lt;/p>
&lt;p>Write a Terraform resource block in your configuration file that corresponds to the resource you created. Make sure the name and type match the Azure resource.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-hcl" data-lang="hcl">&lt;span class="line">&lt;span class="cl">&lt;span class="k">resource&lt;/span> &lt;span class="s2">&amp;#34;azurerm_storage_account&amp;#34; &amp;#34;example&amp;#34;&lt;/span> {
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> name&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;sttoimport&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> resource_group_name&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="k">azurerm_resource_group&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="k">example&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="k">name&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> location&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="k">azurerm_resource_group&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="k">example&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="k">location&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> account_tier&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;Standard&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> account_replication_type&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;LRS&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>If you try to apply, an error message will appear, stating that the resource already existis and must be imported&lt;/p>
&lt;p>The simplest way to achieve this is by adding the &lt;code>import&lt;/code> block of code into your tf file. You will need to specify the id of the resource (that one we noted before) and &lt;code>to&lt;/code> which resource it should be imported.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-hcl" data-lang="hcl">&lt;span class="line">&lt;span class="cl">&lt;span class="k">import&lt;/span> {
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> to&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="k">azurerm_storage_account&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="k">example&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> id&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;/subscriptions/&amp;lt;subscription id&amp;gt;/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/stportalcreated&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">}&lt;span class="c1">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># # Create a storage account
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">&lt;/span>&lt;span class="k">resource&lt;/span> &lt;span class="s2">&amp;#34;azurerm_storage_account&amp;#34; &amp;#34;example&amp;#34;&lt;/span> {
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> name&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;sttoimport&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> resource_group_name&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="k">azurerm_resource_group&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="k">example&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="k">name&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> location&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="k">azurerm_resource_group&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="k">example&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="k">location&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> account_tier&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;Standard&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n"> account_replication_type&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;LRS&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>After adding it, run &lt;code>terraform apply&lt;/code> once again.&lt;/p>
&lt;h3 id="terraform-state-file-1">Terraform State file
&lt;/h3>&lt;p>Now we can check once again our Terraform state file. We can note that it&amp;rsquo;s much more extense, and has not only the resource group as in the first deployment, but the storage account as well.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt"> 10
&lt;/span>&lt;span class="lnt"> 11
&lt;/span>&lt;span class="lnt"> 12
&lt;/span>&lt;span class="lnt"> 13
&lt;/span>&lt;span class="lnt"> 14
&lt;/span>&lt;span class="lnt"> 15
&lt;/span>&lt;span class="lnt"> 16
&lt;/span>&lt;span class="lnt"> 17
&lt;/span>&lt;span class="lnt"> 18
&lt;/span>&lt;span class="lnt"> 19
&lt;/span>&lt;span class="lnt"> 20
&lt;/span>&lt;span class="lnt"> 21
&lt;/span>&lt;span class="lnt"> 22
&lt;/span>&lt;span class="lnt"> 23
&lt;/span>&lt;span class="lnt"> 24
&lt;/span>&lt;span class="lnt"> 25
&lt;/span>&lt;span class="lnt"> 26
&lt;/span>&lt;span class="lnt"> 27
&lt;/span>&lt;span class="lnt"> 28
&lt;/span>&lt;span class="lnt"> 29
&lt;/span>&lt;span class="lnt"> 30
&lt;/span>&lt;span class="lnt"> 31
&lt;/span>&lt;span class="lnt"> 32
&lt;/span>&lt;span class="lnt"> 33
&lt;/span>&lt;span class="lnt"> 34
&lt;/span>&lt;span class="lnt"> 35
&lt;/span>&lt;span class="lnt"> 36
&lt;/span>&lt;span class="lnt"> 37
&lt;/span>&lt;span class="lnt"> 38
&lt;/span>&lt;span class="lnt"> 39
&lt;/span>&lt;span class="lnt"> 40
&lt;/span>&lt;span class="lnt"> 41
&lt;/span>&lt;span class="lnt"> 42
&lt;/span>&lt;span class="lnt"> 43
&lt;/span>&lt;span class="lnt"> 44
&lt;/span>&lt;span class="lnt"> 45
&lt;/span>&lt;span class="lnt"> 46
&lt;/span>&lt;span class="lnt"> 47
&lt;/span>&lt;span class="lnt"> 48
&lt;/span>&lt;span class="lnt"> 49
&lt;/span>&lt;span class="lnt"> 50
&lt;/span>&lt;span class="lnt"> 51
&lt;/span>&lt;span class="lnt"> 52
&lt;/span>&lt;span class="lnt"> 53
&lt;/span>&lt;span class="lnt"> 54
&lt;/span>&lt;span class="lnt"> 55
&lt;/span>&lt;span class="lnt"> 56
&lt;/span>&lt;span class="lnt"> 57
&lt;/span>&lt;span class="lnt"> 58
&lt;/span>&lt;span class="lnt"> 59
&lt;/span>&lt;span class="lnt"> 60
&lt;/span>&lt;span class="lnt"> 61
&lt;/span>&lt;span class="lnt"> 62
&lt;/span>&lt;span class="lnt"> 63
&lt;/span>&lt;span class="lnt"> 64
&lt;/span>&lt;span class="lnt"> 65
&lt;/span>&lt;span class="lnt"> 66
&lt;/span>&lt;span class="lnt"> 67
&lt;/span>&lt;span class="lnt"> 68
&lt;/span>&lt;span class="lnt"> 69
&lt;/span>&lt;span class="lnt"> 70
&lt;/span>&lt;span class="lnt"> 71
&lt;/span>&lt;span class="lnt"> 72
&lt;/span>&lt;span class="lnt"> 73
&lt;/span>&lt;span class="lnt"> 74
&lt;/span>&lt;span class="lnt"> 75
&lt;/span>&lt;span class="lnt"> 76
&lt;/span>&lt;span class="lnt"> 77
&lt;/span>&lt;span class="lnt"> 78
&lt;/span>&lt;span class="lnt"> 79
&lt;/span>&lt;span class="lnt"> 80
&lt;/span>&lt;span class="lnt"> 81
&lt;/span>&lt;span class="lnt"> 82
&lt;/span>&lt;span class="lnt"> 83
&lt;/span>&lt;span class="lnt"> 84
&lt;/span>&lt;span class="lnt"> 85
&lt;/span>&lt;span class="lnt"> 86
&lt;/span>&lt;span class="lnt"> 87
&lt;/span>&lt;span class="lnt"> 88
&lt;/span>&lt;span class="lnt"> 89
&lt;/span>&lt;span class="lnt"> 90
&lt;/span>&lt;span class="lnt"> 91
&lt;/span>&lt;span class="lnt"> 92
&lt;/span>&lt;span class="lnt"> 93
&lt;/span>&lt;span class="lnt"> 94
&lt;/span>&lt;span class="lnt"> 95
&lt;/span>&lt;span class="lnt"> 96
&lt;/span>&lt;span class="lnt"> 97
&lt;/span>&lt;span class="lnt"> 98
&lt;/span>&lt;span class="lnt"> 99
&lt;/span>&lt;span class="lnt">100
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-json" data-lang="json">&lt;span class="line">&lt;span class="cl">&lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;version&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">4&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;terraform_version&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;1.6.5&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;serial&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">6&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;lineage&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;f5c71b49-ac3a-e0ec-2529-b017b3c3965f&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;outputs&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;resources&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;mode&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;managed&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;type&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;azurerm_resource_group&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;name&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;example&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;provider&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;provider[\&amp;#34;registry.terraform.io/hashicorp/azurerm\&amp;#34;]&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;instances&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;schema_version&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">0&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;attributes&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;id&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;/subscriptions/337ba254-3aa0-4551-ba8e-89debefaa373/resourceGroups/rg-myresourcegroup&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;location&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;uksouth&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;managed_by&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;name&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;rg-myresourcegroup&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;tags&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;timeouts&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">null&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;sensitive_attributes&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;private&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;xxxx&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;mode&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;managed&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;type&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;azurerm_storage_account&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;name&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;example&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;provider&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;provider[\&amp;#34;registry.terraform.io/hashicorp/azurerm\&amp;#34;]&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;instances&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;schema_version&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">4&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;attributes&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;access_tier&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;Hot&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;account_kind&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;StorageV2&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;account_replication_type&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;LRS&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;account_tier&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;Standard&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;allow_nested_items_to_be_public&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">true&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;allowed_copy_scope&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;azure_files_authentication&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;blob_properties&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;change_feed_enabled&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">false&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;change_feed_retention_in_days&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="mi">0&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;container_delete_retention_policy&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;cors_rule&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;default_service_version&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;delete_retention_policy&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;last_access_time_enabled&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">false&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;restore_policy&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;versioning_enabled&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">false&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;cross_tenant_replication_enabled&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">true&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;custom_domain&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;customer_managed_key&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;default_to_oauth_authentication&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">false&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;edge_zone&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;enable_https_traffic_only&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">true&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;id&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;/subscriptions/337ba254-3aa0-4551-ba8e-89debefaa373/resourceGroups/rg-myresourcegroup/providers/Microsoft.Storage/storageAccounts/sttoimport&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;identity&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;immutability_policy&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;infrastructure_encryption_enabled&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">false&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;is_hns_enabled&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">false&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;large_file_share_enabled&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">null&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;local_user_enabled&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">true&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;location&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;uksouth&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;min_tls_version&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;TLS1_2&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;name&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;sttoimport&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;network_rules&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;bypass&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;AzureServices&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;default_action&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;Allow&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;ip_rules&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;private_link_access&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;virtual_network_subnet_ids&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;nfsv3_enabled&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">false&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="c1">// ... additional attributes truncated for brevity
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">&lt;/span> &lt;span class="nt">&amp;#34;tags&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;timeouts&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">null&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;sensitive_attributes&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;private&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;xxxx&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;dependencies&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="s2">&amp;#34;azurerm_resource_group.example&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">],&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;check_results&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="kc">null&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="conclusion">Conclusion
&lt;/h2>&lt;p>Integrating existing Azure resources into Terraform doesn&amp;rsquo;t have to be complex. By following the steps described in this guide, you can quickly and efficiently bring your Azure infrastructure under Terraform&amp;rsquo;s infrastructure-as-code management. Happy coding!&lt;/p></description></item><item><title>Don’t run out of credits on Azure!</title><link>http://www.wesleycamargo.com/p/dont-run-out-of-credits-on-azure/</link><pubDate>Wed, 06 Dec 2023 19:01:04 +0100</pubDate><guid>http://www.wesleycamargo.com/p/dont-run-out-of-credits-on-azure/</guid><description>&lt;img src="https://cdn-images-1.medium.com/max/800/0*yQ4GvCZbwp2mH6sc" alt="Featured image of post Don’t run out of credits on Azure!" />&lt;h3 id="dont-run-out-of-credits-on-azure-how-to-shutdown-azure-virtual-machines-automatically-with-terraform">Don’t run out of credits on Azure! How to shutdown Azure Virtual Machines automatically with Terraform
&lt;/h3>&lt;p>If you are distracted and forgetful like me, you probably already forgot an Azure Virtual Machine running without need and just figured it out when your Azure credits were gone. To avoid this, check a simple tip on how to solve this problem with Terraform.&lt;/p>
&lt;p>&lt;img src="https://cdn-images-1.medium.com/max/800/0*yQ4GvCZbwp2mH6sc"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@tristangassert?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>Tristan Gassert&lt;/a> on &lt;a class="link" href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;p>In my&lt;a class="link" href="https://medium.com/@camargo-wes/getting-started-with-azure-what-are-azure-virtual-machines-and-how-to-create-it-using-terraform-254c1cb6642b" target="_blank" rel="noopener"
> previous post&lt;/a>, I have already shown how to create an Azure Virtual Machine using Terraform, now I’m adding this feature, which, for me, is very important and helps me to not spend all my Azure Credits in a forgotten VM 🙃.&lt;/p>
&lt;h3 id="what-is-azure-vm-auto-shutdown">What is Azure VM Auto-Shutdown?
&lt;/h3>&lt;p>Azure VM Auto-Shutdown is like setting a timer for your Azure VM. Auto-shutdown allows you to set a specific time so your Virtual Machine will turn off. This is a handful when you create VMs for tests, or even in development/QA environments, where you don’t need your VMs running at night when your team is not working.&lt;/p>
&lt;h3 id="terraform-resource-for-auto-shutdown-of-an-azurevm">Terraform resource for auto-shutdown of an Azure VM
&lt;/h3>&lt;p>To make it work, we will use the Terraform resource &lt;code>azurerm_dev_test_global_vm_shutdown_schedule&lt;/code>. This is part of the Azure &lt;a class="link" href="https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/dev_test_global_vm_shutdown_schedule" target="_blank" rel="noopener"
>Terraform provider&lt;/a>. The usage is quite simple, as we can see below:&lt;/p>
&lt;p>The most important information required are the VM id, daily_recurrence_time, and timezone. Based on this information your VM will be shut down at the time you have defined.&lt;/p>
&lt;h3 id="complete-terraform-to-create-an-azure-vm-with-auto-shutdown">Complete Terraform to create an Azure VM with auto-shutdown
&lt;/h3>&lt;p>To facilitate the understanding of how to integrate it in a real-life scenario, I have implemented the shutdown process in the following complete Terraform file:&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Below it is the link to my GitHub repository where I am creating a library to have all references related to Terraform. I hope that this post despite being simple might be helpful!
&lt;a class="link" href="https://github.com/wesleycamargo/terraform" target="_blank" rel="noopener"
>wesleycamargo/terraform (github.com)&lt;/a>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dont-run-out-of-credits-on-azure/0_0rM_F_9XoS3sP5GW.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="-if-you-find-this-helpful-please-click-the-clap--button-below-a-few-times-to-show-your-support-for-the-author">👋 If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇
&lt;/h4>&lt;h4 id="join-faun-developer-community--get-similar-stories-in-your-inbox-eachweekhttpfromfauntor8zxxd">🚀&lt;a class="link" href="http://from.faun.to/r/8zxxd" target="_blank" rel="noopener"
>Join FAUN Developer Community &amp;amp; Get Similar Stories in your Inbox Each Week&lt;/a>
&lt;/h4></description></item><item><title>Getting Started with Azure: What are Azure Virtual Machines and how to create it using Terraform</title><link>http://www.wesleycamargo.com/p/getting-started-with-azure-what-are-azure-virtual-machines-and-how-to-create-it-using-terraform/</link><pubDate>Tue, 21 Nov 2023 18:45:11 +0100</pubDate><guid>http://www.wesleycamargo.com/p/getting-started-with-azure-what-are-azure-virtual-machines-and-how-to-create-it-using-terraform/</guid><description>&lt;img src="https://cdn-images-1.medium.com/max/800/0*SbgJGQvFOAmWJQfV" alt="Featured image of post Getting Started with Azure: What are Azure Virtual Machines and how to create it using Terraform" />&lt;h3 id="getting-started-with-azure-what-are-azure-virtual-machines-and-how-to-create-it-using-terraform">Getting Started with Azure: What are Azure Virtual Machines and how to create it using Terraform
&lt;/h3>&lt;p>Azure VMs are like your own computer on the cloud. You can choose between different Operational Systems, such as Linux and Windows, and they can be used for different goals, like hosting a website for example.&lt;/p>
&lt;p>&lt;img src="https://cdn-images-1.medium.com/max/800/0*SbgJGQvFOAmWJQfV"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@imgix?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>imgix&lt;/a> on &lt;a class="link" href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;p>Virtual Machines are part of a category called Infrastructure as Code, and they are still relevant in many scenarios, even with the advent of Platform as Code, where you are in control of many aspects, such as security, identity and access, high availability, and others.&lt;/p>
&lt;h3 id="what-do-i-need-to-create-a-virtual-machine-onazure">What do I need to create a Virtual Machine on Azure?
&lt;/h3>&lt;p>To create the VM there are a few Azure resources that are necessary to be created before, as we can see in the image below:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/getting-started-with-azure-what-are-azure-virtual-machines-and-how-to-create-it-using-terraform/1_B2QjgH9A_DVlS9HMakuKTA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="resources-that-are-pre-requisites">Resources that are Pre-requisites
&lt;/h4>&lt;p>There are some resources that are not necessarily part of the same life cycle of your VM, and you might have already created them on your Azure environment. On the script that I am providing below, they are being created, but you might decide to use a resource that already exists.&lt;/p>
&lt;p>**Resource Group: **A resource group works similarly to a folder, where you can group the resources that have something in common. It can be resources of the same type, such as VMs, or the most recommended, resources that share the same life cycle.&lt;/p>
&lt;p>**Virtual Network: **In an Azure VNet, you are able to create a private space, where your resources can communicate securely. It works similarly to the network that you are connected to right now to read this post, but it sits on Azure.&lt;/p>
&lt;p>&lt;strong>Subnet:&lt;/strong> They are subdivisions of a Virtual Network, helping to keep organized and segmented by different types of resources, like Databases, Front and Backend applications.&lt;/p>
&lt;h4 id="resources-that-are-part-of-the-virtual-machine-lifecycle">Resources that are part of the Virtual Machine life cycle
&lt;/h4>&lt;p>**Disks: **Disks are used to store operating systems, applications, or data. Each VM created on Azure has at least one OS Disk, but it can have multiple.&lt;/p>
&lt;p>&lt;strong>Network Interface Card:&lt;/strong> Also known as NIC, a Network Interface Card is responsible for connecting the VM with the network that we saw earlier. Similar to disks, each VM must have at least one, but also multiple NICs are supported.&lt;/p>
&lt;p>&lt;strong>Public IP:&lt;/strong> A Public IP is the communication between the VM and the world. This resource is not mandatory, and in most cases inside a business context, it should be created very cautiously, to avoid any security risk. However, as it is a simple test and I don’t want to complicate it, we need the Public IP to be able to connect to our VM. It is connected to the Network Interface.&lt;/p>
&lt;h3 id="terraform-script">Terraform Script
&lt;/h3>&lt;h4 id="pre-requisites">Pre-requisites
&lt;/h4>&lt;p>Below is the section of Terraform that creates the pre-requisites. As I mentioned before, it is possible to use existing resources, however, you need to adapt the script to use them.&lt;/p>
&lt;p>In this script, we are creating the resource group, virtual network, and subnet.&lt;/p>
&lt;h4 id="virtual-machine">Virtual Machine
&lt;/h4>&lt;p>Finally, this is the script to create the VM resources. Here we create first a Public IP, the Network Interface Card, and associate the PIP on it, and a VM. Note that the Terraform VM resource already abstracts the disk internally. It’s also interesting to highlight that the VM associates the NIC created before, creating a dependency, which Terraform will identify and create in the correct order.&lt;/p>
&lt;p>&lt;strong>Complete Script&lt;/strong>&lt;/p>
&lt;p>Below is the complete script, including provider, variables, and outputs:&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Below it is the link to my GitHub repository where I am creating a library to have all references related to Terraform. I hope that this post despite being simple might be helpful! 
&lt;a class="link" href="https://github.com/wesleycamargo/terraform" target="_blank" rel="noopener"
>wesleycamargo/terraform (github.com)&lt;/a>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/getting-started-with-azure-what-are-azure-virtual-machines-and-how-to-create-it-using-terraform/0_0rM_F_9XoS3sP5GW.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="-if-you-find-this-helpful-please-click-the-clap--button-below-a-few-times-to-show-your-support-for-the-author">👋 If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇
&lt;/h4>&lt;h4 id="join-faun-developer-community--get-similar-stories-in-your-inbox-eachweekhttpfromfauntor8zxxd">🚀&lt;a class="link" href="http://from.faun.to/r/8zxxd" target="_blank" rel="noopener"
>Join FAUN Developer Community &amp;amp; Get Similar Stories in your Inbox Each Week&lt;/a>
&lt;/h4></description></item><item><title>From Terraform to Azure Bicep: What You Need to Know about syntax</title><link>http://www.wesleycamargo.com/p/from-terraform-to-azure-bicep-what-you-need-to-know-about-syntax/</link><pubDate>Fri, 17 Feb 2023 18:31:38 +0100</pubDate><guid>http://www.wesleycamargo.com/p/from-terraform-to-azure-bicep-what-you-need-to-know-about-syntax/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/from-terraform-to-azure-bicep-what-you-need-to-know-about-syntax/1_TaDCxnnAcZb53Fi-ToztNg.jpeg" alt="Featured image of post From Terraform to Azure Bicep: What You Need to Know about syntax" />&lt;h3 id="from-terraform-to-azure-bicep-what-you-need-to-know-aboutsyntax">From Terraform to Azure Bicep: What You Need to Know about syntax
&lt;/h3>&lt;p>&lt;img src="http://www.wesleycamargo.com/img/from-terraform-to-azure-bicep-what-you-need-to-know-about-syntax/1_TaDCxnnAcZb53Fi-ToztNg.jpeg"
loading="lazy"
alt="Image"
>
Photo by Botond Czapp: &lt;a class="link" href="https://www.pexels.com/photo/birds-flying-on-blue-sky-7255793/" target="_blank" rel="noopener"
>https://www.pexels.com/photo/birds-flying-on-blue-sky-7255793/&lt;/a>&lt;/p>
&lt;p>Hey there Terraform experts! I am confident that you know the power of infrastructure as Code in managing and provisioning IT infrastructure and have been applying it with the famous HashiCorp tool. But have you heard about Azure Bicep, the newer Microsoft IaC language for managing Azure resources? If you’re curious about the differences between Terraform and Bicep, and how Bicep can help you better manage your Azure resources, you’ve come to the right place. Let’s dive in and explore the world of Infra as Code with Azure Bicep! In this first post, I’m going to break down the basic differences between Terraform and Bicep file structures. These infrastructure-as-code tools have their own unique syntax and components, so it’s important to know what sets them apart. By the end of this post, you’ll have a solid grasp of what makes them tick.&lt;/p>
&lt;h3 id="introducing-terraform-andbicep">Introducing Terraform and Bicep
&lt;/h3>&lt;p>Terraform and Azure Bicep are two popular Infra as Code (IaC) tools that allow developers and operations teams to manage and provision cloud infrastructure using development practices.&lt;/p>
&lt;p>Terraform is a tool developed by HashiCorp that supports multiple cloud platforms, including Azure, while Azure Bicep is a newer tool developed by Microsoft specifically for managing Azure resources. Both tools have their own syntax and language for defining Infrastructure as Code and offer benefits such as consistency, scalability, and version control. However, there are also some differences between the two, such as how they handle state management and the availability of community-built providers. In the following sessions, we’ll explore the similarities and differences between Terraform and Azure Bicep, and help you decide which tool is best for your infrastructure management needs.&lt;/p>
&lt;h3 id="language-andsyntax">Language and Syntax
&lt;/h3>&lt;p>Terraform and Bicep has a lot in common. Both use their own domain-specific languages, with a declarative approach, support modularization, and are designed to be human-friendly(I am looking at you, ARM Templates 🙃). Terraform uses HashiCorp Configuration Language, also known as HCL, developed by HashiCorp and has several providers, supporting not only Azure, but AWS, GCP, and even VMWare. Bicep is developed by Microsoft with the intention to abstract the usage of ARM Templates and was developed specifically for Azure, which gave a great integration.&lt;/p>
&lt;p>The structure of both languages is similar, within the same building blocks, with the main components being resources, inputs, and outputs, and as I said above, quite easy to read. Below we can see a comparison of the creation of an Azure Storage Account:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/from-terraform-to-azure-bicep-what-you-need-to-know-about-syntax/1_StyddfWR0evZ6TjZ4MKRNQ.png"
loading="lazy"
alt="Image"
>
Image prepared by the author&lt;/p>
&lt;p>Now let’s analyze the main differences:&lt;/p>
&lt;h4 id="provider">Provider
&lt;/h4>&lt;p>The first and biggest difference that note is that in the Terraform example, we have a section called “provider”. As Terraform supports not only Azure but also other providers, it is required to declare the provider that we want to use.&lt;/p>
&lt;p>As Bicep is designed specifically for Azure, the provider statement is not required.&lt;/p>
&lt;h4 id="input">Input
&lt;/h4>&lt;p>Another difference is that the input parameters have different reserved words. In Terraform it’s called &lt;code>variable&lt;/code>, the default values are declared with a &lt;code>default&lt;/code> statement and its syntax require curly brackets.&lt;/p>
&lt;p>Bicep, in turn, declares the inputs by the reserved word &lt;code>param&lt;/code> , the attribution of a default value can be done with the equals sign and it’s not required any brackets. Bicep also has a &lt;code>variable&lt;/code> reserved world, but it’s used not for inputs, below we can see more about it.&lt;/p>
&lt;h4 id="local-variables">Local variables
&lt;/h4>&lt;p>Local variables in Terraform have a special section called &lt;code>locals&lt;/code>. All necessary variables must be declared in this section and must be accessed by the syntax &lt;code>local.&amp;lt;variable name&amp;gt;&lt;/code> and can be used to create combinations and complex operations.&lt;/p>
&lt;p>locals {
resource_group_name = &amp;ldquo;myTerraformResourceGroup&amp;rdquo;
location = &amp;ldquo;West Europe&amp;rdquo;
}On Bicep, it is not necessary to have a specific session, being possible to declare anywhere in the file (although is recommended to do in the beginning to make it more readable). It also makes the syntax a little simpler than in terraform &lt;code>var location = ‘westeurope’&lt;/code>&lt;/p>
&lt;h4 id="resources">Resources
&lt;/h4>&lt;p>Finally something in common! For both, Terraform and Bicep, the resource is declared by the reserved word… &lt;code>resource&lt;/code>! And there is more in common, in both cases, when declaring the resource you need to declare which resource is desired and you also need to create an alias to this resource, so it will be possible to access information from it, even in the case that you have several resources of the same type. The internal properties will be different depending on each resource type, but in general, you need to provide the resource name, SKU, location, and so on.&lt;/p>
&lt;p>Although the concepts are quite the same, the syntax is slightly different as we can see below:&lt;/p>
&lt;p>&lt;strong>Terraform resource:&lt;/strong>&lt;/p>
&lt;p>resource &amp;ldquo;azurerm_storage_account&amp;rdquo; &amp;ldquo;storage&amp;rdquo; {
name = var.storage_account_name
resource_group_name = local.resource_group_name
location = local.location
account_tier = &amp;ldquo;Standard&amp;rdquo;
account_replication_type = &amp;ldquo;LRS&amp;rdquo;
}&lt;strong>Bicep resource:&lt;/strong>&lt;/p>
&lt;p>&lt;code>resource storage &amp;amp;#x27;Microsoft.Storage/storageAccounts@2022-09-01&amp;amp;#x27; = { kind: &amp;amp;#x27;StorageV2&amp;amp;#x27; location: location name: storageAccountName sku: { name: &amp;amp;#x27;Standard_LRS&amp;amp;#x27; } }&lt;/code>n&lt;/p>
&lt;h4 id="output">Output
&lt;/h4>&lt;p>The outputs follow a similar logic as the inputs. Terraform requires curly brackets, Bicep no. In terraform, it is necessary to specify the resource type first, then the alias, and finally the property. It is also important to highlight that is not possible to assign a type to an output in Terraform.&lt;/p>
&lt;p>output &amp;ldquo;storage_account_name&amp;rdquo; {
value = azurerm_storage_account.storage.name
}Bicep is again, slightly simple. No brackets and you can reference by the alias directly, without having to declare the resource type. In Bicep is also possible to assign a type in the output, which is useful in some cases.&lt;/p>
&lt;p>&lt;code>output storageName string = storage.name&lt;/code>n&lt;/p>
&lt;h4 id="terraform-storage-accountexample">Terraform storage account example
&lt;/h4>&lt;h4 id="bicep-storage-accountexample">Bicep storage account example
&lt;/h4>&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>In conclusion, while Terraform and Bicep share some similarities in their purpose and functionality, they have significant differences in syntax, which can affect the user experience and overall efficiency in deploying infrastructure as code. Understanding these syntax differences is crucial for developers to effectively utilize the benefits of each tool and to determine which one is the best fit for a particular project or organization.&lt;/p>
&lt;p>In the upcoming posts, we will dive deeper into other differences between both tools, exploring their impact on various aspects of infrastructure deployment and management, and offering practical tips and solutions to common challenges. Stay tuned to learn more about how to optimize your infrastructure as code with Terraform and Bicep!&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/from-terraform-to-azure-bicep-what-you-need-to-know-about-syntax/0_XC6gJ9HR_xbxqqSp.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="-if-you-find-this-helpful-please-click-the-clap--button-below-a-few-times-to-show-your-support-for-the-author">👋 If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇
&lt;/h4>&lt;h4 id="join-faun-developer-community--get-similar-stories-in-your-inbox-eachweekhttpfromfauntor8zxxd">🚀&lt;a class="link" href="http://from.faun.to/r/8zxxd" target="_blank" rel="noopener"
>Join FAUN Developer Community &amp;amp; Get Similar Stories in your Inbox Each Week&lt;/a>
&lt;/h4></description></item><item><title>Optimize Your Cloud Environment with Azure Platform Landing Zones</title><link>http://www.wesleycamargo.com/p/optimize-your-cloud-environment-with-azure-platform-landing-zones/</link><pubDate>Sun, 12 Feb 2023 20:36:00 +0100</pubDate><guid>http://www.wesleycamargo.com/p/optimize-your-cloud-environment-with-azure-platform-landing-zones/</guid><description>&lt;img src="https://cdn-images-1.medium.com/max/800/0*z0nVJG-R4dKvqap4" alt="Featured image of post Optimize Your Cloud Environment with Azure Platform Landing Zones" />&lt;h3 id="optimize-your-cloud-environment-with-azure-platform-landingzones">Optimize Your Cloud Environment with Azure Platform Landing Zones
&lt;/h3>&lt;p>&lt;img src="https://cdn-images-1.medium.com/max/800/0*z0nVJG-R4dKvqap4"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/de/@zhpix?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>Pascal Meier&lt;/a> on &lt;a class="link" href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;h3 id="what-are-azure-landing-zones-and-why-are-they-important">What are Azure Landing Zones and why are they important?
&lt;/h3>&lt;p>Imagine that you are building a house, it is necessary to prepare the ground and have a solid foundation to grow your walls. Moreover, it is also necessary to prepare essential services, for instance, plumbing, heating and insulation, and electric cables in this foundation, otherwise, it will be more complicated and expensive (although possible) to do it later.&lt;/p>
&lt;p>An Azure Landing Zone is the same as the house foundation, with essential services to support your platform or applications.&lt;/p>
&lt;p>We can say that Azure Landing Zone is a standardized and repeatable framework for deploying and managing resources in Microsoft Azure. It provides a set of best practices and policies, that helps to improve the cloud deployment process and ensure that resources are deployed in a consistent, scalable, and secure manner.&lt;/p>
&lt;h3 id="azure-platform-landingzones">Azure Platform Landing Zones
&lt;/h3>&lt;p>The set of essential services that are shared by multiple applications is also called Platform Landing Zone. These services, such as Networking and Identity management, are typically managed and centralized by dedicated teams, allowing application teams to concentrate on their core business objectives.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/optimize-your-cloud-environment-with-azure-platform-landing-zones/1_et3Q_YBVoZ62rNaL-yKKJQ.png"
loading="lazy"
alt="Image"
>
Azure Platform Landing Zone&lt;/p>
&lt;p>Microsoft divided the Platform Landing Zones into 8 design areas. These design areas are topics that must be carefully planned to ensure the security and performance of the platform:&lt;/p>
&lt;ul>
&lt;li>**Billing and Active Directory **—Billing is the process of tracking and paying for the resources used in an Azure environment. The Azure billing and cost management platform provide the ability to monitor usage and costs, set budgets and alerts, and optimize spending. Azure Active Directory is a cloud-based identity and access management service that provides centralized identity management and robust security features.&lt;/li>
&lt;li>**Identity and access management **— IAM controls access to Azure resources. Azure Active Directory is the main service used for IAM and helps manage user identities, groups, and access to cloud-based apps.&lt;/li>
&lt;li>&lt;strong>Network topology and connectivity&lt;/strong> — It deals with the design and communication between virtual network resources. A good design ensures secure and efficient communication and access to the internet and external resources.&lt;/li>
&lt;li>&lt;strong>Resource organization&lt;/strong> — It involves grouping and managing resources within an Azure environment. It provides structure and scalability, making it easier to manage and control resource access. Resource groups, subscriptions, and policies to improve efficiency are used to reduce complexity, making it easy to adminstrate and ensure policy compliance in the platform.&lt;/li>
&lt;li>&lt;strong>Security&lt;/strong> — This is one of the most important design areas when planning the landing zone. It involves protecting resources with a multi-layered approach, including access control, network security, encryption, and incident response planning.&lt;/li>
&lt;li>**Management — **Management in Azure Landing Zones covers processes and tools used to manage and maintain resources. A well-managed landing zone needs clear roles, a change management process, and a structured approach to resource management.&lt;/li>
&lt;li>**Governance **— This is about setting the rules to keep your Azure environment organized and secure. Azure has tools like Policy and Role-Based Access Control to enforce your policies. To make things easy, make sure roles are clear and have a plan for making changes.&lt;/li>
&lt;li>&lt;strong>Platform automation and DevOps&lt;/strong> — As I am a DevOps guy for almost 10 years, I am suspicious to talk about this topic :D. It basically ensures that tools and processes make the deployment and management of applications and infrastructure easier and faster.&lt;/li>
&lt;/ul>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Azure Platform Landing Zones are the perfect solution for businesses looking to streamline their cloud deployment and management processes. With its centralized services, specialized teams, and powerful tools for automation and DevOps, it makes it easier than ever to bring new applications and services to market. Not to mention, the added security and governance features give peace of mind when it comes to managing resources in the cloud. So, whether you’re just starting your cloud journey or looking to optimize your existing operations, Azure Landing Zones are the way to go! So why wait? Get on board and start experiencing the benefits for yourself!&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/optimize-your-cloud-environment-with-azure-platform-landing-zones/0_f97d9JzKyDdTtruJ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="-if-you-find-this-helpful-please-click-the-clap--button-below-a-few-times-to-show-your-support-for-the-author">👋 If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇
&lt;/h4>&lt;h4 id="join-faun-developer-community--get-similar-stories-in-your-inbox-eachweekhttpfromfauntor8zxxd">🚀&lt;a class="link" href="http://from.faun.to/r/8zxxd" target="_blank" rel="noopener"
>Join FAUN Developer Community &amp;amp; Get Similar Stories in your Inbox Each Week&lt;/a>
&lt;/h4></description></item><item><title>Don’t repeat yourself! Creating Azure Bicep modules 💪</title><link>http://www.wesleycamargo.com/p/dont-repeat-yourself-creating-azure-bicep-modules/</link><pubDate>Mon, 28 Nov 2022 18:34:16 +0100</pubDate><guid>http://www.wesleycamargo.com/p/dont-repeat-yourself-creating-azure-bicep-modules/</guid><description>&lt;img src="https://cdn-images-1.medium.com/max/800/0*ZB8clYDcM2jGQj71" alt="Featured image of post Don’t repeat yourself! Creating Azure Bicep modules 💪" />&lt;h3 id="dont-repeat-yourself-creating-azure-bicep-modules">Don’t repeat yourself! Creating Azure Bicep modules 💪
&lt;/h3>&lt;p>Since our Infrastructure is Code now, why don’t we leverage the best software development practices? Check out this post on achieving reusability on your IaC templates using Bicep Modules!&lt;/p>
&lt;p>&lt;img src="https://cdn-images-1.medium.com/max/800/0*ZB8clYDcM2jGQj71"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@prateekkatyal?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>Prateek Katyal&lt;/a> on &lt;a class="link" href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;h3 id="what-are-azure-bicepmodules">What are Azure Bicep Modules?
&lt;/h3>&lt;p>Bicep Modules are the application of the **Don’t Repeat Yourself **principle, where a Bicep template calls another Bicep template. As a result, this practice enables the reusability of existing code and can speed up the creation of future resources.&lt;/p>
&lt;p>Imagine, for example, that you need to control how infrastructure resources are created. To accomplish this, you can implement rules in the bicep templates that, for example, restrict the size of virtual machines or the regions in which they can be created.&lt;/p>
&lt;p>Since the definition has already been created and the rules, will probably remain the same in the next project, it is not necessary to create a new definition. We can create a module that allows us to save valuable time and money by reusing these definitions.&lt;/p>
&lt;h3 id="how-to-create-an-azure-bicepmodule">How to create an Azure Bicep Module?
&lt;/h3>&lt;p>If you are already familiar with Bicep Templates, creating a Bicep Module is effortless, as a module has exactly the same structure and it is not necessary to add any special configuration. It is possible, inclusive, to reuse existing templates as modules.&lt;/p>
&lt;h3 id="how-to-consume-an-azure-bicepmodule">How to consume an Azure Bicep Module?
&lt;/h3>&lt;h4 id="declaring-a-bicepmodule">&lt;em>&lt;strong>Declaring a Bicep Module&lt;/strong>&lt;/em>
&lt;/h4>&lt;p>When working with Bicep Modules, the syntax changes compared to resources. Instead of declaring &lt;code>resource&lt;/code>the declaration is now &lt;code>module&lt;/code>**. **Additionally, it is necessary to reference the module path, which can be local or remote.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dont-repeat-yourself-creating-azure-bicep-modules/1_qtbw9GCE45MafTDjuJ_6vg.png"
loading="lazy"
alt="Image"
>
Image prepared by the author&lt;/p>
&lt;p>It is also mandatory to add a symbolic name to the resource. The symbolic name can be used to recover an output from the module to be used in another part of the template.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dont-repeat-yourself-creating-azure-bicep-modules/1_dvcRYdnC-LfnI9eJGBiCwA.png"
loading="lazy"
alt="Image"
>
Image prepared by the author&lt;/p>
&lt;p>The property &lt;code>name&lt;/code>** **is mandatory. It will become the nested template name in the final template.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dont-repeat-yourself-creating-azure-bicep-modules/1_6W6RH47RoNV7GF6CfzRC-w.png"
loading="lazy"
alt="Image"
>
Image prepared by the author&lt;/p>
&lt;h4 id="passing-parameters-to-bicepmodules">&lt;em>&lt;strong>Passing parameters to Bicep modules&lt;/strong>&lt;/em>
&lt;/h4>&lt;p>The parameters on modules follow the same syntax and contain the same features as regular templates. However, to send the parameters to a module it must be under the &lt;code>params&lt;/code> node. It must match those declared in the module, including the validations.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dont-repeat-yourself-creating-azure-bicep-modules/1_QOZF4MK2Y5SfT6AuO2m2jg.png"
loading="lazy"
alt="Image"
>
Image prepared by the author&lt;/p>
&lt;h3 id="how-to-deploy-an-azure-bicepmodule">How to deploy an Azure Bicep Module?
&lt;/h3>&lt;p>Deployment of Bicep Modules works exactly like Bicep Templates. It is possible to use &lt;a class="link" href="https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-cli?WT.mc_id=DT-MVP-5004039" target="_blank" rel="noopener"
>Azure CLI&lt;/a>, &lt;a class="link" href="https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-powershell?WT.mc_id=DT-MVP-5004039" target="_blank" rel="noopener"
>Azure PowerShell&lt;/a>, or even through &lt;a class="link" href="https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-rest?WT.mc_id=DT-MVP-5004039" target="_blank" rel="noopener"
>Azure API.&lt;/a>&lt;/p>
&lt;p>I explain in more detail in &lt;a class="link" href="https://medium.com/faun/creating-infrastructure-as-code-for-azure-with-azure-bicep-step-by-step-58f03cee75e1" target="_blank" rel="noopener"
>this post&lt;/a> how to deploy using Azure CLI. Below we can see the script used to deploy the templates and modules created above.&lt;/p>
&lt;p>After running it is possible to see in the deployments of Azure Resource Group the main.bicep deployment:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dont-repeat-yourself-creating-azure-bicep-modules/1_4QSoI-AuLcjYe9zxF6iiiQ.png"
loading="lazy"
alt="Image"
>
Image prepared by the author&lt;/p>
&lt;p>And if we click on the nested storage deployment we can observe the resource storageAccount being deployed :&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dont-repeat-yourself-creating-azure-bicep-modules/1_gqdrDwcLHLaVUXVLbG31_Q.png"
loading="lazy"
alt="Image"
>
Image prepared by the author&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Reusability is one of the main advantages that we can leverage from modularization in any programming language and with Infrastructure as Code templates, it wouldn’t be different. Another benefit is that it also will ensure that your environment is more stable as your templates will be already tested by others, and most importantly, will also save implementation time.&lt;/p>
&lt;p>I hope this helps you, and see you at the next one!&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dont-repeat-yourself-creating-azure-bicep-modules/0_JSaWL5U0fpZZ0xeP.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="-if-you-find-this-helpful-please-click-the-clap--button-below-a-few-times-to-show-your-support-for-the-author">👋 If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇
&lt;/h4>&lt;h4 id="join-faun-developer-community--get-similar-stories-in-your-inbox-eachweekhttpfromfauntor8zxxd">🚀&lt;a class="link" href="http://from.faun.to/r/8zxxd" target="_blank" rel="noopener"
>Join FAUN Developer Community &amp;amp; Get Similar Stories in your Inbox Each Week&lt;/a>
&lt;/h4></description></item><item><title>Stop breaking your environment: How to get started with Azure DevOps Pipelines</title><link>http://www.wesleycamargo.com/p/stop-breaking-your-environment-how-to-get-started-with-azure-devops-pipelines/</link><pubDate>Mon, 07 Nov 2022 15:17:27 +0100</pubDate><guid>http://www.wesleycamargo.com/p/stop-breaking-your-environment-how-to-get-started-with-azure-devops-pipelines/</guid><description>&lt;img src="https://cdn-images-1.medium.com/max/800/0*EkiWY-eBH6JhvNEU" alt="Featured image of post Stop breaking your environment: How to get started with Azure DevOps Pipelines" />&lt;h3 id="stop-breaking-your-environment-how-to-get-started-with-azure-devops-pipelines">Stop breaking your environment: How to get started with Azure DevOps Pipelines
&lt;/h3>&lt;p>Have you ever had problems with manual deployments? It is not about if but when an error will happen. I even saw entire sites being replaced wrongly! It is scary, isn’t it? Azure DevOps Pipelines will help you to avoid such mistakes, so check on this post how to deploy your application in minutes, taking advantage of all benefits that automated pipelines can bring to you!&lt;/p>
&lt;p>&lt;img src="https://cdn-images-1.medium.com/max/800/0*EkiWY-eBH6JhvNEU"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@louishansel?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>Louis Hansel&lt;/a> on &lt;a class="link" href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;h3 id="what-is-azure-devops-pipelines">What is Azure DevOps Pipelines?
&lt;/h3>&lt;p>A Deployment Pipeline is an automated process that combines Continuous Integration (CI) and Continuous Delivery (CD), deploying your application in a given environment. In other words, it automatically builds, tests, and deploys your code to make them available to other people.&lt;/p>
&lt;h3 id="prerequisites">Prerequisites
&lt;/h3>&lt;p>Before we start creating the pipelines, there are configurations that we need to prepare in advance. My friend &lt;a class="link" href="https://www.devjev.nl/" target="_blank" rel="noopener"
>Jev Suchoi&lt;/a> and I have already created a series of posts covering all these topics:&lt;/p>
&lt;ul>
&lt;li>&lt;a class="link" href="https://www.devjev.nl/posts/2022/how-to-create-an-organization-in-azure-devops/" target="_blank" rel="noopener"
>&lt;strong>How to create an Azure DevOps organization&lt;/strong>&lt;/a>&lt;/li>
&lt;li>&lt;strong>How to configure your Azure DevOps project&lt;/strong>&lt;/li>
&lt;li>[&lt;strong>Basic git commands you need to know&lt;/strong>](http://Git Basic commands in a nutshell)&lt;/li>
&lt;li>&lt;a class="link" href="https://camargo-wes.medium.com/git-basic-commands-in-a-nutshell-fc911c9f350a" target="_blank" rel="noopener"
>&lt;strong>Pushing code to git&lt;/strong>&lt;/a>&lt;/li>
&lt;li>&lt;strong>Connecting Azure DevOps with Azure&lt;/strong>&lt;/li>
&lt;li>&lt;strong>Creating a variable group on Azure DevOps&lt;/strong>&lt;/li>
&lt;/ul>
&lt;h3 id="how-to-create-an-azure-devopspipeline">How to create an Azure DevOps pipeline
&lt;/h3>&lt;p>Azure DevOps Pipelines are an implementation of deployment pipelines that supports multiple programming languages and clouds. Basically, everything can be deployed using this tool.&lt;/p>
&lt;p>So let’s create our first pipeline!&lt;/p>
&lt;p>First of all, we need our application under a Version Control System. In &lt;a class="link" href="https://camargo-wes.medium.com/git-basic-commands-in-a-nutshell-fc911c9f350a" target="_blank" rel="noopener"
>&lt;strong>this post&lt;/strong>&lt;/a>, I showed how to create a local repository for a dotnet core application, and &lt;a class="link" href="https://medium.com/@camargo-wes/azure-devops-remote-repositories-in-a-nutshell-how-to-create-and-push-your-code-to-git-219d3e1df71" target="_blank" rel="noopener"
>**here **&lt;/a>I show how to push the code to a remote repository on Azure Repos.&lt;/p>
&lt;p>With the repo in place, go to Pipelines on the left menu, and then click on &lt;strong>New pipeline&lt;/strong>:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/stop-breaking-your-environment-how-to-get-started-with-azure-devops-pipelines/1_zW4FBgtDLNby8FJinT8teQ.png"
loading="lazy"
alt="Image"
>
Image by Author&lt;/p>
&lt;p>In the new window, choose your repository. In this example we are using the Azure Repo that we created on the post mentioned above:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/stop-breaking-your-environment-how-to-get-started-with-azure-devops-pipelines/1_M1g7_hmhSaBOQJs6-TzG2w.png"
loading="lazy"
alt="Image"
>
Image by Author&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/stop-breaking-your-environment-how-to-get-started-with-azure-devops-pipelines/1_IJZAmr6glzC5EW9PvB1DOg.png"
loading="lazy"
alt="Image"
>
Image by Author&lt;/p>
&lt;p>Choose the **Starter pipeline. **If you already have your own YAML, you can choose the Existing option.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/stop-breaking-your-environment-how-to-get-started-with-azure-devops-pipelines/1_7dKmLb-LGN8neBcanVm9Eg.png"
loading="lazy"
alt="Image"
>
Image by Author&lt;/p>
&lt;h4 id="azure-devops-pipelineanatomy">Azure DevOps Pipeline anatomy
&lt;/h4>&lt;p>Azure DevOps will create a skeleton of a pipeline. It is quite simple, but enough to start. Let’s see what we have there:&lt;/p>
&lt;ul>
&lt;li>**Trigger — **This is the configuration about which branch(or branches) our pipeline will be triggered if we have new commits. Normally this is tied to your branch strategy, by default it is created to the default branch in the chosen repository.&lt;/li>
&lt;li>**Pool **— The pools are a set of machines that run our build inside. Azure DevOps has two pools when it’s created. The **Default **is a pool in which you can add your own agents. **Azure Pipelines **on the other hand is a SaaS agent that Microsoft provisions.&lt;/li>
&lt;li>**Steps **— Finally it starts to be fun, we have the steps! They are instructions that we send to agents in order to complete our pipeline. In some cases, they can be simple command-line scripts, but we can also make use of “packaged scripts” in the Microsoft marketplace, also known as &lt;strong>Tasks&lt;/strong>.&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/stop-breaking-your-environment-how-to-get-started-with-azure-devops-pipelines/1_ioGI-irRd-PRszOq7ZfqOQ.png"
loading="lazy"
alt="Image"
>
Image by Author&lt;/p>
&lt;p>To prepare the pipeline for dotnet core, we will change the pool to &lt;strong>windows-latest&lt;/strong>, as I am using a Windows machine, I want to keep the same.&lt;/p>
&lt;p>And we will also use a &lt;strong>dotnet core task&lt;/strong>, with the publish command. It will prepare all the artifacts necessary to deploy our application.&lt;/p>
&lt;p>In the next step, we will use an Azure Web App task, that will deploy in deploy in App Service previously created in Azure. Pay attention that a service connection is required here, so make sure that the name matches yours.&lt;/p>
&lt;p>Below there is all you need to create this pipeline. Simply delete the content created automatically and replace it.&lt;/p>
&lt;h3 id="how-to-create-an-azure-devops-pipeline-withstages">How to create an Azure DevOps pipeline with stages
&lt;/h3>&lt;p>Now let&amp;rsquo;s make it a bit more complex :). The pipeline above will cover some simple scenarios, mostly for testing and learning. However, if you need something more robust, you will need to organize it in a better way.&lt;/p>
&lt;p>There are two resources on Azure Pipelines that will enable it: &lt;strong>Stages&lt;/strong> and &lt;strong>jobs.&lt;/strong>&lt;/p>
&lt;h4 id="what-are-jobs-in-azuredevops">What are Jobs in Azure DevOps?
&lt;/h4>&lt;p>In a few words, **Jobs **are sets of **Steps **that run together. Every pipeline has at least one job, even if you do not specify one, by default your steps will be encapsulated in a job.&lt;/p>
&lt;p>There are multiple scenarios where the use of multiple jobs is beneficial, as per separate responsibilities, running different jobs in parallel, and so on.&lt;/p>
&lt;p>There is one special type of job for deployments. It is recommended to use it as brings some benefits as Deployment history and the possibility to use pre-configured strategies, such as canary, blue-green, etc.&lt;/p>
&lt;p>To specify a job, you can simply add this to your pipeline:&lt;/p>
&lt;h4 id="what-are-stages-in-azuredevops">What are Stages in Azure DevOps?
&lt;/h4>&lt;p>As we saw above that Jobs are sets of Steps, so guess what? Stages are sets of… Jobs!&lt;/p>
&lt;p>To determine the boundaries of your deployment, pausing and validating before moving on, Stages must be used.&lt;/p>
&lt;p>I recommend structuring your pipelines in the following manner:&lt;/p>
&lt;ul>
&lt;li>One stage to gather all artifacts that will be used during the deployment, also known as a “build stage” (in some cases, you don’t need a real build generating binaries, as some languages don’t produce them, as IaC languages or even PHP for example).&lt;/li>
&lt;li>Different deployment stages for different environments, for example, Development, UAT, and Production. It will allow you to validate the quality of your code during the journey toward production.&lt;/li>
&lt;/ul>
&lt;p>The stage structure is similar to the job syntax, and contains one or more jobs:&lt;/p>
&lt;p>Below we can see the conversion of the simple pipeline to a complete pipeline using **Jobs **and &lt;strong>Stages:&lt;/strong>&lt;/p>
&lt;h3 id="key-takeaways">Key takeaways
&lt;/h3>&lt;p>Azure Pipelines is a powerful and very flexible tool that can technically support all programming languages, clouds, and technologies. It is part of Azure DevOps ecosystem, having native integration with with the other tools, do not require external integrations, however it also supports if required, and it makes quite easy to configure and increase productivity from the first moment you start to use it.&lt;/p>
&lt;p>I hope this would help you, and see you in the next post!&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/stop-breaking-your-environment-how-to-get-started-with-azure-devops-pipelines/0_rbBIrAtLWWmh60Qi.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="-if-you-find-this-helpful-please-click-the-clap--button-below-a-few-times-to-show-your-support-for-the-author">👋 If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇
&lt;/h4>&lt;h4 id="join-faun-developer-community--get-similar-stories-in-your-inbox-eachweekhttpfromfauntor8zxxd">🚀&lt;a class="link" href="http://from.faun.to/r/8zxxd" target="_blank" rel="noopener"
>Join FAUN Developer Community &amp;amp; Get Similar Stories in your Inbox Each Week&lt;/a>
&lt;/h4></description></item><item><title>How to deploy Management Groups with Azure Bicep and Azure DevOps</title><link>http://www.wesleycamargo.com/p/how-to-deploy-management-groups-with-azure-bicep-and-azure-devops/</link><pubDate>Mon, 26 Sep 2022 15:04:40 +0200</pubDate><guid>http://www.wesleycamargo.com/p/how-to-deploy-management-groups-with-azure-bicep-and-azure-devops/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/how-to-deploy-management-groups-with-azure-bicep-and-azure-devops/1_dpWnelmmdCalVRtcf1k5fQ.jpeg" alt="Featured image of post How to deploy Management Groups with Azure Bicep and Azure DevOps" />&lt;h3 id="how-to-deploy-management-groups-with-azure-bicep-and-azuredevops">How to deploy Management Groups with Azure Bicep and Azure DevOps
&lt;/h3>&lt;p>If you have several Subscriptions on your Azure Tenant, Management Groups can be very handy to organize them. Check in this post, on how to deploy Management Groups using Azure Bicep.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-deploy-management-groups-with-azure-bicep-and-azure-devops/1_dpWnelmmdCalVRtcf1k5fQ.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@ianjbattaglia?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Ian Battaglia&lt;/a> on &lt;a class="link" href="https://unsplash.com/collections/16762197/data-center?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;h3 id="what-are-azurescopes">What are Azure Scopes?
&lt;/h3>&lt;p>According to official Microsoft documentation “&lt;em>Scope&lt;/em> is the set of resources that access applies to.” This is used to have granularity when assigning permission in your Azure resources. The majority of Azure resources are deployed into the Resource Group scope, and when we use Azure bicep, this is the default. But there are four levels of scopes in Azure as we can see in the image below:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-deploy-management-groups-with-azure-bicep-and-azure-devops/0_7OACaXq6bHYTogMW.png"
loading="lazy"
alt="Image"
>
Azure Scope levels — Image from &lt;a class="link" href="https://learn.microsoft.com/en-us/azure/role-based-access-control/scope-overview?WT.mc_id=DT-MVP-5004039" target="_blank" rel="noopener"
>Microsoft Docs&lt;/a>&lt;/p>
&lt;p>With that said, when we are deploying a resource different than those deployed at the resource level, we need to specify against which scope we are running it. For Management groups, the scope must be the **tenant. **In the following sessions, we will see how to set it up.&lt;/p>
&lt;h4 id="bicep-scope-to-deploy-azure-management-groups">Bicep scope to deploy Azure Management Groups
&lt;/h4>&lt;p>As said before, the default scope in an Azure Bicep script is the resource group. For most traditional resources such as App Services, or Storage Accounts, it is not necessary to specify it, but to deploy management groups it is necessary to specify the tenant as the target scope:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-deploy-management-groups-with-azure-bicep-and-azure-devops/1_9ubvxa-Zjx8xk4dz0iucFw.png"
loading="lazy"
alt="Image"
>
Image prepared by Author&lt;/p>
&lt;p>Below it’s possible to see the code necessary for the most basic creation of a Management Group:&lt;/p>
&lt;h4 id="how-to-call-an-azure-bicep-template-at-the-management-group-scope-with-azure-cli-and-azure-devops-yaml-pipelines">How to call an Azure Bicep template at the Management Group scope with Azure CLI and Azure DevOps YAML pipelines
&lt;/h4>&lt;p>To run deployments against tenant scope it is also necessary to specify it in Azure CLI&lt;/p>
&lt;p>Below there is an Azure DevOps YAML pipeline with the task configured to deploy the bicep file created above:&lt;/p>
&lt;h3 id="spn-permissions-to-deploy-azure-management-groups">SPN permissions to deploy Azure Management Groups
&lt;/h3>&lt;p>By default, the Service Principal Name does not have permission to deploy tenant resources. You need to grant it at the root scope “/” to make it work.&lt;/p>
&lt;p>In this case, the error below will show up:&lt;/p>
&lt;p>&lt;code>ash AuthorizationFailed: The client with object id does not have authorization to perform action 'Microsoft.Resources/deployments/validate/action' over scope '/providers/Microsoft.Resources/deployments/main' or the scope is invalid. &lt;/code>&lt;/p>
&lt;h4 id="how-to-elevate-user-permissions-as-azure-ad-global-administrator">How to elevate user permissions as Azure AD Global Administrator
&lt;/h4>&lt;p>First, you need to elevate your permissions as user Global Administrator into Azure AD:&lt;/p>
&lt;h4 id="how-to-grant-service-principal-name-permissions-to-deploy-azure-management-groups">How to grant Service Principal Name permissions to deploy Azure Management Groups
&lt;/h4>&lt;p>After setting up your permissions as Global Administrator, you are able to set your SPN with the correct permissions:&lt;/p>
&lt;h3 id="the-best-azure-management-groups-naming-convention">The best Azure Management Groups naming convention
&lt;/h3>&lt;p>It is also crucial to properly name your Management Groups, making them easy to maintain, especially if you are adopting Infrastructure as Code with automated pipelines. Also, if you have multiple directories, you also need to efficiently identify which directory a particular management group belongs to.&lt;/p>
&lt;p>My friend &lt;a class="link" href="https://twitter.com/DevJevNL" target="_blank" rel="noopener"
>@DevJevNL&lt;/a> has an excellent proposal to tackle the naming convention in a series of posts, here is his suggestion for &lt;a class="link" href="https://www.devjev.nl/posts/2022/the-ideal-management-group-naming-convention/" target="_blank" rel="noopener"
>Management Groups.&lt;/a>&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Although it is a very simple process, there are some tricks to deploying management groups. In this post, I tried to clarify all the necessary steps to deploy it. Below it is possible to visualize the management group deployed in our Azure Tenant.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-deploy-management-groups-with-azure-bicep-and-azure-devops/1_v7ss3g8wQRZUMN4XuXvs8w.png"
loading="lazy"
alt="Image"
>
Image prepared by Author&lt;/p>
&lt;h3 id="references">References
&lt;/h3>&lt;p>&lt;a class="link" href="https://learn.microsoft.com/en-us/azure/role-based-access-control/elevate-access-global-admin?WT.mc_id=DT-MVP-5004039" target="_blank" rel="noopener"
>https://learn.microsoft.com/en-us/azure/role-based-access-control/elevate-access-global-admin&lt;/a>
&lt;a class="link" href="https://github.com/Azure/Enterprise-Scale/blob/main/docs/EnterpriseScale-Setup-azure.md" target="_blank" rel="noopener"
>&lt;strong>Enterprise-Scale/EnterpriseScale-Setup-azure.md at main · Azure/Enterprise-Scale&lt;/strong>
*This article will guide you through the process of configuring permissions in your Azure environment to enable ARM…*github.com&lt;/a>&lt;a class="link" href="https://github.com/Azure/Enterprise-Scale/blob/main/docs/EnterpriseScale-Setup-azure.md" target="_blank" rel="noopener"
>&lt;/a>&lt;/p></description></item><item><title>Creating Infrastructure as Code for Azure with Azure Bicep step by step</title><link>http://www.wesleycamargo.com/p/creating-infrastructure-as-code-for-azure-with-azure-bicep-step-by-step/</link><pubDate>Wed, 23 Mar 2022 10:54:57 +0100</pubDate><guid>http://www.wesleycamargo.com/p/creating-infrastructure-as-code-for-azure-with-azure-bicep-step-by-step/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/creating-infrastructure-as-code-for-azure-with-azure-bicep-step-by-step/1_opFga-VoKoV_iJ_UdsHyIQ.jpeg" alt="Featured image of post Creating Infrastructure as Code for Azure with Azure Bicep step by step" />&lt;h3 id="creating-infrastructure-as-code-for-azure-with-azure-bicep-step-bystep">Creating Infrastructure as Code for Azure with Azure Bicep step by step
&lt;/h3>&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-infrastructure-as-code-for-azure-with-azure-bicep-step-by-step/1_opFga-VoKoV_iJ_UdsHyIQ.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@golfarisa?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Arisa Chattasa&lt;/a> on &lt;a class="link" href="https://unsplash.com/s/photos/boxing?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;p>One of the natural steps towards DevOps and Cloud Adoption is to create your Infrastructure using Code. For Azure, the most convenient language for this is Azure Bicep which abstracts several aspects of this complex process, and supports more resources available in Azure than any other tool, making it one of the most powerful Infrastructure as Code tools for Azure.&lt;/p>
&lt;h3 id="what-is-azurebicep">What is Azure Bicep?
&lt;/h3>&lt;p>According to &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/overview?tabs=bicep" target="_blank" rel="noopener"
>Microsoft Documentation&lt;/a>, this is the definition of Bicep:&lt;/p>
&lt;blockquote>
&lt;p>Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. In a Bicep file, you define the infrastructure you want to deploy to Azure, and then use that file throughout the development lifecycle to repeatedly deploy your infrastructure.&lt;/p>
&lt;/blockquote>
&lt;p>In summary, this is an abstraction over ARM templates which simplifies A LOT the development of Infrastructure as Code. Its syntax is much simpler and less verbose than ARM but still has all its capabilities.&lt;/p>
&lt;p>As bicep is a DSL, we can consider ARM as an Intermediate Language and we can “build” bicep into ARM to perform our deployments. A curiosity is that the name bicep is a play on words for ARM (Azure Resource Manager) 😄.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-infrastructure-as-code-for-azure-with-azure-bicep-step-by-step/0_Xj6hKE461XITJs6O.gif"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="how-to-create-an-azure-resource-group-with-azurebicep">How to create an Azure Resource Group with Azure Bicep?
&lt;/h3>&lt;p>Usually, one of the firsts resources on Azure that we need to create is a Resource Group, as it will group all other resources, and make it easier to administrate.&lt;/p>
&lt;p>Create an Azure Resource Group using Azure Bicep it is quite simple, you need just the name of the resource group and the location that it will be created. Additionally, it is necessary to define the &lt;code>*targeScope *&lt;/code>as a subscription, it will be explained in more detail below.&lt;/p>
&lt;p>It is possible to deploy it in different ways, using Azure PowerShell, Azure CLI, or even Azure API’s. In this example, we will use Azure CLI to execute the deployment.&lt;/p>
&lt;h3 id="how-to-execute-an-azure-resource-group-deployment-with-azure-bicep-and-azurecli">How to execute an Azure Resource Group deployment with Azure Bicep and Azure CLI?
&lt;/h3>&lt;p>On the latest versions of Azure CLI, there are different commands to run deployments against different scopes on Azure. To create Azure Resource Groups, it is necessary to use the *subscription *scope, which was also defined on the bicep template above.&lt;/p>
&lt;p>The command used is &lt;code>az deployment sub create&lt;/code> :&lt;/p>
&lt;p>After running the script, we can check the resource group with the command &lt;code>az group show --name rg-bicepdemo&lt;/code> :&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-infrastructure-as-code-for-azure-with-azure-bicep-step-by-step/1_VqjeZS9nGltwhUhh5dnfKw.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;h3 id="how-to-create-an-azure-storage-account-with-azure-bicep-and-azurecli">How to create an Azure Storage Account with Azure Bicep and Azure CLI?
&lt;/h3>&lt;p>When we will create a “common” resource, like Storage Account, Resource Group scope must be used. This is the default behavior of bicep, so it is not necessary to specify like it was for Resource Group creation.&lt;/p>
&lt;p>To create resources on Resource Group scope, the Azure CLI command used must be &lt;code>az deployment group create&lt;/code> :&lt;/p>
&lt;p>To check the Storage Account creation run the command &lt;code>az storage account show --name stbicepdemo&lt;/code>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-infrastructure-as-code-for-azure-with-azure-bicep-step-by-step/1_cpJGnAWnd5Epc1NgkxxQ4A.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;p>As they are in different scopes, it is not possible to run both bicep files with one command, however, I prepared a PowerShell script to run them in sequence:&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Azure Bicep is one of the most promising Infra as Code tools for Azure, and it is quite simple to create new templates for it. Its syntax is very simple and easy to learn, so why not give it a chance? :)&lt;/p>
&lt;p>See you in the next post!
[&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-infrastructure-as-code-for-azure-with-azure-bicep-step-by-step/1_BCiLLad3dvZLwBa-B5cAVQ.png"
loading="lazy"
alt="Image"
>
](&lt;a class="link" href="https://faun.to/bP1m5" target="_blank" rel="noopener"
>https://faun.to/bP1m5&lt;/a>)&lt;/p>
&lt;p>Join FAUN: &lt;a class="link" href="https://faun.to/i9Pt9" target="_blank" rel="noopener"
>&lt;strong>Website&lt;/strong>&lt;/a>** &lt;strong>💻&lt;/strong>|&lt;strong>&lt;a class="link" href="https://faun.dev/podcast" target="_blank" rel="noopener"
>&lt;strong>Podcast&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🎙️&lt;/strong>|&lt;strong>&lt;a class="link" href="https://twitter.com/joinfaun" target="_blank" rel="noopener"
>&lt;strong>Twitter&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🐦&lt;/strong>|&lt;strong>&lt;a class="link" href="https://www.facebook.com/faun.dev/" target="_blank" rel="noopener"
>&lt;strong>Facebook&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>👥&lt;/strong>|&lt;strong>&lt;a class="link" href="https://instagram.com/fauncommunity/" target="_blank" rel="noopener"
>&lt;strong>Instagram&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>📷|&lt;a class="link" href="https://www.facebook.com/groups/364904580892967/" target="_blank" rel="noopener"
>&lt;strong>Facebook Group&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🗣️&lt;/strong>|&lt;strong>&lt;a class="link" href="https://www.linkedin.com/company/faundev" target="_blank" rel="noopener"
>&lt;strong>Linkedin Group&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>💬&lt;/strong>|** &lt;a class="link" href="https://faun.dev/chat" target="_blank" rel="noopener"
>&lt;strong>Slack&lt;/strong>&lt;/a> 📱&lt;strong>|&lt;/strong>&lt;a class="link" href="https://thechief.io" target="_blank" rel="noopener"
>&lt;strong>Cloud Native&lt;/strong> &lt;strong>News&lt;/strong>&lt;/a>** &lt;strong>📰&lt;/strong>|&lt;strong>&lt;a class="link" href="https://linktr.ee/faun.dev/" target="_blank" rel="noopener"
>&lt;strong>More&lt;/strong>&lt;/a>&lt;/strong>.**&lt;/p>
&lt;p>&lt;strong>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇&lt;/strong>&lt;/p></description></item><item><title>First steps with Azure: Creating an Azure Resource Group with Azure CLI</title><link>http://www.wesleycamargo.com/p/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/</link><pubDate>Mon, 07 Mar 2022 18:25:56 +0100</pubDate><guid>http://www.wesleycamargo.com/p/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/1_EERoSBDh5ydWiIxF4MQ_mw.jpeg" alt="Featured image of post First steps with Azure: Creating an Azure Resource Group with Azure CLI" />&lt;h3 id="first-steps-with-azure-creating-an-azure-resource-group-with-azurecli">First steps with Azure: Creating an Azure Resource Group with Azure CLI
&lt;/h3>&lt;p>An Azure Resource Group is a container that holds related resources for an Azure solution. This is an important resource in Azure and in this post, I will continue the series of Basic commands for Azure CLI and show how it is possible to create Azure Resource Groups using Azure CLI.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/1_EERoSBDh5ydWiIxF4MQ_mw.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@photosimon?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Simon Infanger&lt;/a> on &lt;a class="link" href="https://unsplash.com/s/photos/baby-steps-sand?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;h3 id="what-is-azcli">What is Az CLI?
&lt;/h3>&lt;p>Az CLI or Azure CLI is a command line interface with Azure. It can be used in any command line prompt, including PowerShell and Bash, and it allows the creation of resources and resource groups, executing actions, and much more possibilities. In the previous post, I showed the basic commands to connect and configure your Azure Subscription using Azure CLI, if you don’t know how to configure your Azure CLI local environment you can &lt;a class="link" href="https://faun.pub/an-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli-22c2c68ce4d9" target="_blank" rel="noopener"
>check it here&lt;/a>.&lt;/p>
&lt;h3 id="what-is-an-azure-resourcegroup">What is an Azure Resource Group
&lt;/h3>&lt;p>According to Microsoft documentation, this is the definition of an Azure Resource Group:&lt;/p>
&lt;blockquote>
&lt;p>A resource group is a container that holds related resources for an Azure solution. The resource group can include all the resources for the solution, or only those resources that you want to manage as a group. You decide how you want to allocate resources to resource groups based on what makes the most sense for your organization. Generally, add resources that share the same lifecycle to the same resource group so you can easily deploy, update, and delete them as a group.&lt;/p>
&lt;/blockquote>
&lt;p>In practice, we can consider it as a “Directory” on Azure where you can group your resources. There are many ways to organize it, the most common is to make them small with resources of the same context.&lt;/p>
&lt;p>For more information, you can check the official documentation &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-portal#what-is-a-resource-group" target="_blank" rel="noopener"
>here&lt;/a>.&lt;/p>
&lt;h3 id="az-cli-commands-for-azure-resourcegroup">Az CLI commands for Azure Resource Group
&lt;/h3>&lt;h4 id="azure-resource-group---summary-ofcommands">Azure Resource Group - Summary of commands
&lt;/h4>&lt;p>Below there is a summary of all commands used in this tutorial. You can copy it and replace the values between &amp;lt;&amp;gt; to your own values :)&lt;/p>
&lt;h4 id="how-to-use-az-clihelp">How to use Az CLI Help?
&lt;/h4>&lt;p>It is also possible to check all commands related to resource groups with the command &lt;code>az --help&lt;/code> . For more details about how to use the help check&lt;a class="link" href="https://faun.pub/an-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli-22c2c68ce4d9" target="_blank" rel="noopener"
> this post&lt;/a> where I also show how to login into Azure Subscription with Azure CLI.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/1_qzsCZn6P4B_IGE7aNc54Xw.png"
loading="lazy"
alt="Image"
>
az group help — Image by author&lt;/p>
&lt;h3 id="how-to-list-existing-azure-resource-groups-with-azcli">How to list existing Azure Resource Groups with Az CLI
&lt;/h3>&lt;p>The command used to list Azure Resource Groups is &lt;code>az group list&lt;/code> . It will return a JSON by default. To have a more human understandable output you can add &lt;code>--output table&lt;/code>in front of the command or any other output of your choice. The final command would be&lt;code>az group list --output table&lt;/code> .&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/1_Jg2D1lp2XIK4jOkssyQKqA.png"
loading="lazy"
alt="Image"
>
az group list — Image by author&lt;/p>
&lt;h3 id="how-to-create-an-azure-resource-group-with-azcli">How to create an Azure Resource Group with Az CLI
&lt;/h3>&lt;p>To create a new Azure Resource Group, it is necessary to provide two required information:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Location&lt;/strong>: The Azure Region where your resource group will be created.&lt;/li>
&lt;li>**Name: **The name of your Resource Group&lt;/li>
&lt;/ul>
&lt;p>The final command is &lt;code>az group create --location &amp;lt;location of your resource group&amp;gt; --name &amp;lt;name of your resource group&amp;gt;&lt;/code> . Replace the content between &amp;lt;&amp;gt; with your own values .&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/1_Jyy_7GHOHiTDpqud7hGruw.png"
loading="lazy"
alt="Image"
>
az group create — Image by author&lt;/p>
&lt;p>To check additional options use the command &lt;code>az group --help&lt;/code> .&lt;/p>
&lt;p>After creation, run again the command &lt;code>az group list --output table&lt;/code>to check if the resource group is shown.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/1_u805NgHvFi7QjF5qTGfICw.png"
loading="lazy"
alt="Image"
>
az group list — Image by author&lt;/p>
&lt;h3 id="how-to-show-details-of-an-azure-resource-group-with-azcli">How to show details of an Azure Resource Group with Az CLI
&lt;/h3>&lt;p>To check the details of a specific Resource Group, you can run the command &lt;code>az group show --name &amp;lt;your resource group name&amp;gt;&lt;/code> . This command returns basically the same information after the creation command.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/1_p_zyDT4xi590b0oXXbIewQ.png"
loading="lazy"
alt="Image"
>
az group show — Image by author&lt;/p>
&lt;h3 id="how-to-delete-an-azure-resource-group-with-azcli">How to delete an Azure Resource Group with Az CLI
&lt;/h3>&lt;p>The delete command will prompt if you are sure about executing the delete operation. This is because all resources created under this resource group will also be deleted, so run this command only when you want to delete them as well.&lt;/p>
&lt;p>After the conclusion of the command, after running the list command the created resource group is not listed anymore.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/1_sXlJmtY762m-Y74U2dVfHw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>The Resource Groups are an important part of Azure and automating its creation is a fundamental part of a DevOps process.&lt;/p>
&lt;p>See you in the next post!
[&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/first-steps-with-azure-creating-an-azure-resource-group-with-azure-cli/1_BCiLLad3dvZLwBa-B5cAVQ.png"
loading="lazy"
alt="Image"
>
](&lt;a class="link" href="https://faun.to/bP1m5" target="_blank" rel="noopener"
>https://faun.to/bP1m5&lt;/a>)&lt;/p>
&lt;p>Join FAUN: &lt;a class="link" href="https://faun.to/i9Pt9" target="_blank" rel="noopener"
>&lt;strong>Website&lt;/strong>&lt;/a>** &lt;strong>💻&lt;/strong>|&lt;strong>&lt;a class="link" href="https://faun.dev/podcast" target="_blank" rel="noopener"
>&lt;strong>Podcast&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🎙️&lt;/strong>|&lt;strong>&lt;a class="link" href="https://twitter.com/joinfaun" target="_blank" rel="noopener"
>&lt;strong>Twitter&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🐦&lt;/strong>|&lt;strong>&lt;a class="link" href="https://www.facebook.com/faun.dev/" target="_blank" rel="noopener"
>&lt;strong>Facebook&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>👥&lt;/strong>|&lt;strong>&lt;a class="link" href="https://instagram.com/fauncommunity/" target="_blank" rel="noopener"
>&lt;strong>Instagram&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>📷|&lt;a class="link" href="https://www.facebook.com/groups/364904580892967/" target="_blank" rel="noopener"
>&lt;strong>Facebook Group&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🗣️&lt;/strong>|&lt;strong>&lt;a class="link" href="https://www.linkedin.com/company/faundev" target="_blank" rel="noopener"
>&lt;strong>Linkedin Group&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>💬&lt;/strong>|** &lt;a class="link" href="https://faun.dev/chat" target="_blank" rel="noopener"
>&lt;strong>Slack&lt;/strong>&lt;/a> 📱&lt;strong>|&lt;/strong>&lt;a class="link" href="https://thechief.io" target="_blank" rel="noopener"
>&lt;strong>Cloud Native&lt;/strong> &lt;strong>News&lt;/strong>&lt;/a>** &lt;strong>📰&lt;/strong>|&lt;strong>&lt;a class="link" href="https://linktr.ee/faun.dev/" target="_blank" rel="noopener"
>&lt;strong>More&lt;/strong>&lt;/a>&lt;/strong>.**&lt;/p>
&lt;p>&lt;strong>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇&lt;/strong>&lt;/p></description></item><item><title>The entry gate to Azure: Configuring your Azure subscription with Azure CLI</title><link>http://www.wesleycamargo.com/p/the-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli/</link><pubDate>Fri, 25 Feb 2022 16:51:35 +0100</pubDate><guid>http://www.wesleycamargo.com/p/the-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/the-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli/1_WUN0NX9YOBytDa6iXLB5BQ.jpeg" alt="Featured image of post The entry gate to Azure: Configuring your Azure subscription with Azure CLI" />&lt;h3 id="the-entry-gate-to-azure-configuring-your-azure-subscription-with-azurecli">The entry gate to Azure: Configuring your Azure subscription with Azure CLI
&lt;/h3>&lt;p>Azure CLI is a command line interface with Azure. It can be used in any command line prompt, including PowerShell and Bash, and it allows the creation of resources and resource groups, executing actions like an Azure Data Factory pipeline, and much more possibilities. In this post, I will show the basic commands to connect and configure your Azure Subscription.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/the-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli/1_WUN0NX9YOBytDa6iXLB5BQ.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@craft_ear?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Jan Tinneberg&lt;/a> on &lt;a class="link" href="https://unsplash.com/s/photos/door-open?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;h3 id="how-to-set-an-azure-subscription-with-azurecli">How to set an Azure Subscription with Azure CLI
&lt;/h3>&lt;h4 id="azure-cli-commands-for-login-andaccount">Azure CLI commands for Login and Account
&lt;/h4>&lt;p>Below is a summary of all commands used&lt;/p>
&lt;p>Now let’s see the details of execution for each command.&lt;/p>
&lt;h4 id="how-to-know-which-commands-to-use-in-azurecli">How to know which commands to use in Azure CLI
&lt;/h4>&lt;p>At least in the beginning until you get familiar with the commands a very useful tip is to make use of the help command. It’s quite simple and you just need to add &lt;code>--help&lt;/code> or &lt;code>-h&lt;/code> after the command. The most basic would be to run it after &lt;code>az&lt;/code> like &lt;code>az --help&lt;/code> . It will show all subgroups and commands available for the tool.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/the-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli/0_Ghwg5Wn9fm0PpMfY.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;h4 id="how-to-login-into-azure-with-azurecli">How to login into Azure with Azure CLI
&lt;/h4>&lt;p>The easiest way to login into Azure is using the interactive mode. It will open a new tab on your browser with the authentication page.&lt;/p>
&lt;p>To do it run the command &lt;code>az login&lt;/code> and choose your account:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/the-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli/1_cFaJ-sa-gDYIgWNEKGGXOA.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;p>By default, after choosing your account it will prompt a list of available subscriptions on that account. These subscriptions can also be listed with the command az account list, described below.&lt;/p>
&lt;h4 id="how-to-set-a-subscription-with-azurecli">How to set a subscription with Azure CLI
&lt;/h4>&lt;p>First, we need to see which subscriptions are available. To do it run the command &lt;code>az account list&lt;/code> , this command will display all subscriptions available in your logged accounts.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/the-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli/1_u7pxouSyHjtGeWysTrJMWQ.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;p>Once you have your subscriptions id, you can connect to it through the command &lt;code>az account set --subscription&lt;/code> . After this command, you can confirm if the subscription was settled by running the command &lt;code>az account show&lt;/code>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/the-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli/0_GxY7TQADhWhLRz4y.png"
loading="lazy"
alt="Image"
>
Ìmage by author&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Although the commands are simple, they are very important, as they are an entry gate to interact with Azure.
[&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/the-entry-gate-to-azure-configuring-your-azure-subscription-with-azure-cli/1_BCiLLad3dvZLwBa-B5cAVQ.png"
loading="lazy"
alt="Image"
>
](&lt;a class="link" href="https://faun.to/bP1m5" target="_blank" rel="noopener"
>https://faun.to/bP1m5&lt;/a>)&lt;/p>
&lt;p>Join FAUN: &lt;a class="link" href="https://faun.to/i9Pt9" target="_blank" rel="noopener"
>&lt;strong>Website&lt;/strong>&lt;/a>** &lt;strong>💻&lt;/strong>|&lt;strong>&lt;a class="link" href="https://faun.dev/podcast" target="_blank" rel="noopener"
>&lt;strong>Podcast&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🎙️&lt;/strong>|&lt;strong>&lt;a class="link" href="https://twitter.com/joinfaun" target="_blank" rel="noopener"
>&lt;strong>Twitter&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🐦&lt;/strong>|&lt;strong>&lt;a class="link" href="https://www.facebook.com/faun.dev/" target="_blank" rel="noopener"
>&lt;strong>Facebook&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>👥&lt;/strong>|&lt;strong>&lt;a class="link" href="https://instagram.com/fauncommunity/" target="_blank" rel="noopener"
>&lt;strong>Instagram&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>📷|&lt;a class="link" href="https://www.facebook.com/groups/364904580892967/" target="_blank" rel="noopener"
>&lt;strong>Facebook Group&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🗣️&lt;/strong>|&lt;strong>&lt;a class="link" href="https://www.linkedin.com/company/faundev" target="_blank" rel="noopener"
>&lt;strong>Linkedin Group&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>💬&lt;/strong>|** &lt;a class="link" href="https://faun.dev/chat" target="_blank" rel="noopener"
>&lt;strong>Slack&lt;/strong>&lt;/a> 📱&lt;strong>|&lt;/strong>&lt;a class="link" href="https://thechief.io" target="_blank" rel="noopener"
>&lt;strong>Cloud Native&lt;/strong> &lt;strong>News&lt;/strong>&lt;/a>** &lt;strong>📰&lt;/strong>|&lt;strong>&lt;a class="link" href="https://linktr.ee/faun.dev/" target="_blank" rel="noopener"
>&lt;strong>More&lt;/strong>&lt;/a>&lt;/strong>.**&lt;/p>
&lt;p>&lt;strong>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇&lt;/strong>&lt;/p></description></item><item><title>Criando Azure Resource Group com Azure CLI</title><link>http://www.wesleycamargo.com/p/criando-azure-resource-group-com-azure-cli/</link><pubDate>Thu, 24 Feb 2022 18:26:54 +0100</pubDate><guid>http://www.wesleycamargo.com/p/criando-azure-resource-group-com-azure-cli/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/criando-azure-resource-group-com-azure-cli/1_cilM3e42GLTP7Tod8bXeQg.jpeg" alt="Featured image of post Criando Azure Resource Group com Azure CLI" />&lt;h3 id="criando-azure-resource-group-com-azurecli">Criando Azure Resource Group com Azure CLI
&lt;/h3>&lt;p>O Azure CLI é uma interface de linha de comando para o Azure. Ele pode ser usado com PowerShell ou em bash, com ele é possível criar recursos, resource groups, executar ações no Azure entre outras coisas. Aqui vou mostrar os comandos básicos para conectar ao Azure utilizando o Azure CLI e como criar um resource group.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-azure-resource-group-com-azure-cli/1_cilM3e42GLTP7Tod8bXeQg.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@fakurian?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Milad Fakurian&lt;/a> on &lt;a class="link" href="https://unsplash.com/?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;p>No vídeo abaixo é possível acompanhar todo o processe de conexão ao Azure e criação do Resource Group usando Azure CLI. Após o vídeo estão os comandos utilizados e um breve resumo sobre seu uso.&lt;/p>
&lt;h3 id="como-conectar-ao-azure-com-azurecli">Como conectar ao Azure com Azure CLI
&lt;/h3>&lt;h4 id="azure-cli---comandos-paraaccount">Azure CLI - comandos para Account
&lt;/h4>&lt;p>Abaixo estão todos os comandos utilizados para realizar login e configurar a Azure Subscription para ser utilizada&lt;/p>
&lt;p>Agora vamos ver os detalhes de execuçao dos comandos:&lt;/p>
&lt;p>&lt;code>az -h&lt;/code> — Lista os comandos disponíveis no Azure CLI&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-azure-resource-group-com-azure-cli/1_xtFjXLBbgrQw6IOTLT5HZA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;code>az login&lt;/code>- Abre a página de login no browser para selecionar a conta que será conectada&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-azure-resource-group-com-azure-cli/1_cFaJ-sa-gDYIgWNEKGGXOA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;code>az account list&lt;/code> - Lista as subscription disponíveis
&lt;code>az account set -subscription&lt;/code> - Seleciona a subscription que será usada
&lt;code>az account show&lt;/code> - Exibe as informações da subscription atual&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-azure-resource-group-com-azure-cli/1_UXnIG5vzHh8dZ51X44rqtw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="como-criar-um-azure-resource-group-com-azurecli">Como criar um Azure Resource Group com Azure CLI
&lt;/h3>&lt;h4 id="azure-clicomandos-para-resourcegroup">Azure CLI — comandos para Resource Group
&lt;/h4>&lt;p>&lt;code>az group -h&lt;/code> - Lista os comandos disponíveis para Resource Groups
&lt;code>az group create -h&lt;/code> - Lista os argumentos necessários para criar um Resource Group&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-azure-resource-group-com-azure-cli/1_q9u4264fwYxWQQ2l2ieLEA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;code>az group create --location -–name&lt;/code> - Cria um Resource Group&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-azure-resource-group-com-azure-cli/1_ZKz9LJWr6lrBvZFPGKMJjA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;code>az group list --output table&lt;/code> - Lista Resource Groups da subscription em formato de tabela&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-azure-resource-group-com-azure-cli/1_ru6Eh_JTfYgz9ooYcZqZ6w.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;code>az group delete --name&lt;/code>- Apaga o Resource Group&lt;/p></description></item><item><title>Creating and publishing PowerShell Modules to Azure Artifacts with Azure DevOps YAML Pipelines</title><link>http://www.wesleycamargo.com/p/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/</link><pubDate>Thu, 03 Feb 2022 00:02:46 +0100</pubDate><guid>http://www.wesleycamargo.com/p/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/1_fsn7lNWadvhhO4YLZ_YTxQ.jpeg" alt="Featured image of post Creating and publishing PowerShell Modules to Azure Artifacts with Azure DevOps YAML Pipelines" />&lt;h3 id="creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines">Creating and publishing PowerShell Modules to Azure Artifacts with Azure DevOps YAML Pipelines
&lt;/h3>&lt;p>PowerShell Modules are very useful and can save a lot of time if well designed and created. Check on this post how to create and pack a basic PowerShell Module, and publish it into Azure Artifact using Azure DevOps YAML Pipelines.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/1_fsn7lNWadvhhO4YLZ_YTxQ.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@trnavskauni?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Trnava University&lt;/a> on &lt;a class="link" href="https://unsplash.com/s/photos/artifact?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;h3 id="creating-powershell-module-and-powershell-modulemanifest">Creating PowerShell Module and PowerShell Module Manifest
&lt;/h3>&lt;h4 id="creating-a-powershell-module--psm1">Creating a PowerShell Module - psm1
&lt;/h4>&lt;p>A PowerShell Module is a way to organize and pack a set of PowerShell components to be reused or shared. The most common components to be shared are functions.&lt;/p>
&lt;p>In this example, we will create the module &lt;code>Example.Module&lt;/code> with the extension &lt;code>psm1&lt;/code> , and include a PowerShell function.&lt;/p>
&lt;h4 id="creating-a-powershell-module-manifest--psd1">Creating a PowerShell Module Manifest - psd1
&lt;/h4>&lt;p>To create the Module Manifest, it is possible to run the cmdlet &lt;code>New-ModuleManifest&lt;/code> . It will generate the &lt;code>psd1&lt;/code> manifest file with default configurations.&lt;/p>
&lt;p>The most important variables are &lt;code>NestedModules&lt;/code> and &lt;code>RootModule&lt;/code> which must contain the name of the psm1 file.&lt;/p>
&lt;h4 id="creating-a-nuspec-file-for-the-powershell-module">Creating a nuspec file for the PowerShell Module
&lt;/h4>&lt;p>To create the nuspec file you need to run the command &lt;code>nuget spec Example.Module&lt;/code> . It will generate a base file that it is possible to replace with your values.&lt;/p>
&lt;h4 id="making-the-powershell-module-versiondynamic">Making the PowerShell Module version dynamic
&lt;/h4>&lt;p>In both &lt;code>psm1&lt;/code>(1) and &lt;code>nuspec&lt;/code> (2) files there is a variable &lt;code>$(version)&lt;/code> . This variable will be replaced by the version defined in the deployment pipeline. It uses the &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&amp;amp;tabs=yaml%2Cbatch#understand-variable-syntax" target="_blank" rel="noopener"
>Azure DevOps macro syntax&lt;/a> to consume the variables.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/1_hC2Fp7Sq3dAcnFCrOSfRSA.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/1_TOn6t_70pay-LOgPYJVjAg.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;h3 id="creating-an-azure-artifacts-feed">Creating an Azure Artifacts Feed
&lt;/h3>&lt;p>For instructions on how to create a feed, you can check this post where I also show how to push a dotnet Core package to Azure Artifacts:&lt;/p>
&lt;p>&lt;a class="link" href="https://camargo-wes.medium.com/how-to-send-net-core-nuget-packages-to-azure-artifacts-238fa08db6b5" target="_blank" rel="noopener"
>How to send .Net Core NuGet packages to Azure Artifacts | by Wesley Camargo | Medium&lt;/a>&lt;/p>
&lt;h3 id="deploying-powershell-module-with-azure-devops-yaml-pipeline-into-azureartifact">Deploying PowerShell Module with Azure DevOps YAML Pipeline into Azure Artifact
&lt;/h3>&lt;h4 id="version-number-to-update-powershell-module">Version Number to update PowerShell Module
&lt;/h4>&lt;p>To simplify this example, we will provide the version number of the module by Azure DevOps parameter(1). Then we populate a variable with the value of the parameter using template expression syntax(2). In a future post, I will how to bump this number automatically.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/1_ntWVJnMc2jpUqLegnE_fkw.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;h4 id="replacing-version-number-in-nuspec-and-modulemanifest">Replacing version number in nuspec and module manifest
&lt;/h4>&lt;p>The next step is to replace the variable &lt;code>$(version)&lt;/code> mentioned above with the version number. To do it will be used the &lt;a class="link" href="https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens" target="_blank" rel="noopener"
>replace token task&lt;/a>. Note that we specify the extensions of the manifest and nuspec files.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/1_xMkiWFVlx2G_UJ_M6-pinQ.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;h4 id="packing-powershell-module-withnuget">Packing PowerShell Module with NuGet
&lt;/h4>&lt;p>To pack the module is used the NuGetCommand task, and specified the nuspec file. After generating the NuGet package it will be published as a pipeline artifact - be careful not to confuse with Azure Artifacts, we are almost there but not yet :) - which will be consumed in the next stage: deployment.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/1_RNGcd5bStLWiDOzCSIUTpA.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;h4 id="pushing-powershell-module-to-azure-artifacts">Pushing PowerShell Module to Azure Artifacts
&lt;/h4>&lt;p>Finally, in the deployment stage, we will push our package into our Azure Artifacts. It will also use the NuGet Command task to push it, sending the &lt;code>nupkg&lt;/code> generate in the build stage. It is also necessary to provide the name of the Azure Artifacts Feed.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/1_8L4ufhKDW1GtuEU_gsEPyQ.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;h4 id="complete-azure-pipelinesyml-to-publish-powershell-modules-to-azure-artifacts">Complete azure-pipelines.yml to publish PowerShell Modules to Azure Artifacts
&lt;/h4>&lt;p>[&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-and-publishing-powershell-modules-to-azure-artifacts-with-azure-devops-yaml-pipelines/1_BCiLLad3dvZLwBa-B5cAVQ.png"
loading="lazy"
alt="Image"
>
](&lt;a class="link" href="https://faun.to/bP1m5" target="_blank" rel="noopener"
>https://faun.to/bP1m5&lt;/a>)&lt;/p>
&lt;p>Join FAUN: &lt;a class="link" href="https://faun.to/i9Pt9" target="_blank" rel="noopener"
>&lt;strong>Website&lt;/strong>&lt;/a>** &lt;strong>💻&lt;/strong>|&lt;strong>&lt;a class="link" href="https://faun.dev/podcast" target="_blank" rel="noopener"
>&lt;strong>Podcast&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🎙️&lt;/strong>|&lt;strong>&lt;a class="link" href="https://twitter.com/joinfaun" target="_blank" rel="noopener"
>&lt;strong>Twitter&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🐦&lt;/strong>|&lt;strong>&lt;a class="link" href="https://www.facebook.com/faun.dev/" target="_blank" rel="noopener"
>&lt;strong>Facebook&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>👥&lt;/strong>|&lt;strong>&lt;a class="link" href="https://instagram.com/fauncommunity/" target="_blank" rel="noopener"
>&lt;strong>Instagram&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>📷|&lt;a class="link" href="https://www.facebook.com/groups/364904580892967/" target="_blank" rel="noopener"
>&lt;strong>Facebook Group&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🗣️&lt;/strong>|&lt;strong>&lt;a class="link" href="https://www.linkedin.com/company/faundev" target="_blank" rel="noopener"
>&lt;strong>Linkedin Group&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>💬&lt;/strong>|** &lt;a class="link" href="https://faun.dev/chat" target="_blank" rel="noopener"
>&lt;strong>Slack&lt;/strong>&lt;/a> 📱&lt;strong>|&lt;/strong>&lt;a class="link" href="https://thechief.io" target="_blank" rel="noopener"
>&lt;strong>Cloud Native&lt;/strong> &lt;strong>News&lt;/strong>&lt;/a>** &lt;strong>📰&lt;/strong>|&lt;strong>&lt;a class="link" href="https://linktr.ee/faun.dev/" target="_blank" rel="noopener"
>&lt;strong>More&lt;/strong>&lt;/a>&lt;/strong>.**&lt;/p>
&lt;p>&lt;strong>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇&lt;/strong>&lt;/p></description></item><item><title>Delivery as Code with Azure DevOps Release Engine</title><link>http://www.wesleycamargo.com/p/delivery-as-code-with-azure-devops-release-engine/</link><pubDate>Fri, 28 Jan 2022 19:05:03 +0100</pubDate><guid>http://www.wesleycamargo.com/p/delivery-as-code-with-azure-devops-release-engine/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1__BNFAVB90d4cdBvFgz7loA.jpeg" alt="Featured image of post Delivery as Code with Azure DevOps Release Engine" />&lt;h3 id="delivery-as-code-with-azure-devops-releaseengine">Delivery as Code with Azure DevOps Release Engine
&lt;/h3>&lt;p>Delivery as Code is the concept of having all necessary configurations of your delivery defined in a file, which can be kept under source control and have all good practices applied to application development over it. It ensures that your deliveries are consistent and reliable.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1__BNFAVB90d4cdBvFgz7loA.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@actionjackson801?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Jackson Hendry&lt;/a> on &lt;a class="link" href="https://unsplash.com/s/photos/night-sky?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;h3 id="everything-ascode">Everything as Code
&lt;/h3>&lt;p>In the past years, everything is becoming “as Code”. It started with Infrastructure as Code, aka IaC, and today there are many languages supporting it, since the AWS Cloud Formation, passing through Terraform and Pulumi, that are Cloud agnostics, until the Azure ARM Templates and his newborn son Azure Bicep.&lt;/p>
&lt;p>But there are also other uses of as Code, such as Database as Code, Pipelines as Code, Monitoring as Code, Security as Code, and so forth, this list is big and still growing.&lt;/p>
&lt;h4 id="why-have-my-definitions-ascode">Why have my definitions as code?
&lt;/h4>&lt;p>One of the reasons behind this is if you have the instructions to create your environment versioned, you can easily reproduce the steps to create it. Imagine that for some reason you lose your infrastructure environment, in some minutes you can spin up a new environment based on the versioned definitions.&lt;/p>
&lt;p>Another reason is that as you can easily create a new environment, you can apply development good practices on it. For example, you can deploy a new environment using the versioned scripts, and run Unit Tests against it. With frameworks like Pester this is easy to implement.&lt;/p>
&lt;h3 id="what-is-delivery-ascode">What is Delivery as Code?
&lt;/h3>&lt;p>The advantages of having definitions under source control are clear, so why do not apply them in the Delivery of the software?&lt;/p>
&lt;p>With that in mind and my passion to automate everything that I can, I started to develop an easy way to configure the releases and make them as simple as possible, based on my experience working in the DevOps field.&lt;/p>
&lt;p>To configure a new delivery, instead of configuring manually or having scripts of how to implement it, you just need to inform what you need and all the complexity of the implementation will be abstracted. This is the declarative approach very keen on Infrastructure as Code, which allows you have indepotent deployments.&lt;/p>
&lt;h3 id="what-is-azure-devops-releaseengine">What is Azure DevOps Release Engine
&lt;/h3>&lt;p>Azure DevOps Release Engine is an approach developed to support Delivery as Code. It was built on top of Azure DevOps YAML Templates and can be used to deploy any kind of technology, with any kind of tool anywhere.&lt;/p>
&lt;p>It means that you can deploy languages such as:&lt;/p>
&lt;ul>
&lt;li>dotnet Core&lt;/li>
&lt;li>nodeJS&lt;/li>
&lt;li>Java&lt;/li>
&lt;/ul>
&lt;p>Using any tool like:&lt;/p>
&lt;ul>
&lt;li>Azure Bicep&lt;/li>
&lt;li>Terraform&lt;/li>
&lt;li>Cloud Formation&lt;/li>
&lt;li>Pulumi&lt;/li>
&lt;/ul>
&lt;p>In any platform:&lt;/p>
&lt;ul>
&lt;li>Azure&lt;/li>
&lt;li>AWS&lt;/li>
&lt;li>VMWare&lt;/li>
&lt;li>OnPremisses data centers&lt;/li>
&lt;/ul>
&lt;h3 id="how-does-azure-devops-release-enginework">How does Azure DevOps Release Engine work?
&lt;/h3>&lt;p>Azure DevOps Release Engine was created using Azure DevOps YAML Pipelines as a support tool. It consists of a centralized repository where they centralize deployment definitions - the instructions of how to deploy - are versioned and Client/Application repositories which must have the declaration of what should be deployed.&lt;/p>
&lt;p>The client application repository must have a YAML pipeline that extends from the main YAML in the centralized repository - &lt;a class="link" href="https://towardsdev.com/how-to-extend-an-azure-devops-yaml-pipeline-template-b9d851c5e872" target="_blank" rel="noopener"
>here there is a post explaining how the extended pipelines work&lt;/a>. The main file is responsible to parse the instructions provided and deciding which definition must be used.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_TdY4HlqI1O_KNVr0Rljknw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="centralized-release-definitions">Centralized Release definitions
&lt;/h4>&lt;p>The definitions in this repository can be reused, saving time and allowing all deployments of the same kind of component to be deployed in the same way, which leads to more consistent and less problematic releases, as the deployment instructions were well tested.&lt;/p>
&lt;h4 id="clientapplication-repositories">Client/Application repositories
&lt;/h4>&lt;p>The client repositories are the repos where your applications are versioned. It can have any sort of resource to be deployed and to consume the Release Engine you just need to create a YAML file following the Azure DevOps Release Engine schema.&lt;/p>
&lt;h3 id="how-to-set-up-azure-devops-releaseengine">How to set up Azure DevOps Release Engine?
&lt;/h3>&lt;h4 id="importing-the-repo-into-azuredevops">Importing the repo into Azure DevOps
&lt;/h4>&lt;p>In the Azure DevOps Release Engine repository at GitHub copy the link to the repository following the sequence below:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_uPtLLtDIIbY3RKAgTjMX7A.png"
loading="lazy"
alt="Image"
>
Copy the repository URL — Image by author&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_aqO2RG6w41ox4JDYWe8twg.png"
loading="lazy"
alt="Image"
>
Click in Import repository — Image by author&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_wvfx90_WRO7LRsbyJ_v-Dw.png"
loading="lazy"
alt="Image"
>
Paste the link and import — Image by author&lt;/p>
&lt;p>After it you should have the repository in your Azure DevOps repos, with the structure below:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_-E9yirfM67UbeJjnPi8rVg.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;h3 id="how-to-set-up-the-application-to-consume-the-azure-devops-releaseengine">How to set up the application to consume the Azure DevOps Release engine?
&lt;/h3>&lt;h4 id="repository-structure">Repository structure
&lt;/h4>&lt;p>In a dotnet Core application repository add the file azure-pipelines.yml in the root folder, and one file corresponding to each environment that will be deployed in a “variables” directory. I recommend having the source code under a different directory to keep the repository cleaner and tidy, in my case it’s under the &lt;code>src&lt;/code>directory.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_wZ_WvkWKvUAYkNZIJD1R9Q.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;h4 id="creating-the-azure-pipelinesyml-file">Creating the azure-pipelines.yml file
&lt;/h4>&lt;p>This file contains all instructions on what resources need to be deployed. I will add the complete file in the end so it will be possible to just copy it ;).&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_4ozkyI8QtFth7UpEaAZQGw.png"
loading="lazy"
alt="Image"
>
“Importing” a repository in Azure DevOps — Image by author&lt;/p>
&lt;p>The beginning of the file contains pipeline configurations that will be the same in most of the pipelines. The declaration of Release Engine as a repository resource is very important, as the templates will be consumed from this resource that will be “imported”.&lt;/p>
&lt;h4 id="azure-devops-release-enginesettings">Azure DevOps Release Engine settings
&lt;/h4>&lt;p>With Release Engine imported, it is necessary now to extend from the main.yml file &lt;strong>(1)&lt;/strong>. This file is basically a parser that will read the information provided as parameters and redirect to the correct file. I will deep dive into this file in future posts.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_G470hXFe5jMfVuOFv_Stkw.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;p>The most important section is the &lt;strong>parameters&lt;/strong>. This section contains all information that will be provided to the engine. As mentioned above this information will be parsed by the main file, and according to the resource types provided. call the right definition to deploy it.&lt;/p>
&lt;p>**Release settings
**Inside parameters, the session **settings (2) **contain the configuration of your release.&lt;/p>
&lt;p>**Azure settings
**In the current version, it is possible to enable or disable the deployment of your infrastructure, application, and build &lt;strong>(3)&lt;/strong>. Here it is also necessary to provide the directory of your variable files. The variables will be explained later. It is possible to provide the values straight on this file,&lt;/p>
&lt;p>**Environments
**It is also necessary to provide information about your Azure environment &lt;strong>(4)&lt;/strong>, such as service connection, resource group where the resources will be deployed, and so on. If the parameter **new **under resource group is provided, it will also create the resource group.&lt;/p>
&lt;p>Last but not least, you must declare which environments will be deployed. The way that it was built will create exactly the same configuration for all environments, which ensures that the implementation in your production environment will follow the same steps as in the others, increasing the &lt;strong>reliability of the delivery&lt;/strong>, as was mentioned at the beginning of this post.&lt;/p>
&lt;h4 id="configuring-resources-to-be-deployed-with-azure-devops-releaseengine">Configuring resources to be deployed with Azure DevOps Release Engine
&lt;/h4>&lt;p>The latest section in the azure-pipelines.yml is the resource. This is a list of resources that will be deployed in this release and its configurations. In this example, we are going to deploy a dotnet Core application into an Azure Web App. Let’s go through the main items in this section:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_WWvMG336nyZ1iMQj4kWsPQ.png"
loading="lazy"
alt="Image"
>
Image by author&lt;/p>
&lt;p>**name **- This is the name of the web app that will be created into Azure. This is provided through a parameter that is stored in the respective variable file of the environment that is running. It means that you can deploy in different environments like dev, uat and prd with unique names, avoiding conflicts.&lt;/p>
&lt;p>**type **- The type is parsed inside the main.yml file and calls the right deployment definition for the type provided. This example is a dotnet Core application but it is possible to deploy any resource with the deployment definition already implemented on Release Engine.&lt;/p>
&lt;p>&lt;strong>runName&lt;/strong> - Run name is the name of the Azure DevOps job. This is necessary to make the run unique and have the possibility to link dependent resources.&lt;/p>
&lt;p>&lt;strong>enabled&lt;/strong> - It is possible to easily disable the deployment of this resource.&lt;/p>
&lt;p>&lt;strong>deploy.type&lt;/strong> - Inform which type of deployment it is. In this example, the dotnet Core application will be deployed into an Azure Web App.&lt;/p>
&lt;p>&lt;strong>deploy.infrastructure.servicePlanName&lt;/strong> - Similar to the name, we are informing the name of the service plan that will be used by our Azure Web App.&lt;/p>
&lt;h4 id="configuring-variables-for-azure-devops-releaseengine">Configuring variables for Azure DevOps Release Engine
&lt;/h4>&lt;p>As mentioned before, it is necessary one variable file per environment. The variable file allows having resources with unique names in the environments.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_aQ7Pc0GTl1tcQViMPWR7Xw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>This file will be loaded automatically by the engine, so the only action necessary is to add the file following the patter {env-name}-vars.yml, where env-name is the name defined at azure-pipelines.yml&lt;/p>
&lt;p>After being loaded by the engine, the variables will be available like any other variable in Azure DevOps. In azure-pipelines the variables are accessed using the macro syntax $(variable-name).&lt;/p>
&lt;h4 id="complete-template">Complete template
&lt;/h4>&lt;p>Below there is the complete template for dotnet Core and Azure Web Apps. You can also check the repository with more examples and the implementation of the engine on &lt;a class="link" href="https://github.com/devopsnights/AzureDevOpsReleaseEngine" target="_blank" rel="noopener"
>Azure DevOps Release Engine repository at GitHub&lt;/a>.&lt;/p>
&lt;h3 id="takeaways">Takeaways
&lt;/h3>&lt;p>The Azure DevOps Release Engine simplifies the release configuration, abstracting the release definition providing an “as Code” approach for your Delivery.&lt;/p>
&lt;p>This is a work in progress but built on top of a very mature process based on real-life experience, solving real-life problems that we face in our day-by-day activities.&lt;/p>
&lt;p>I hope it can help, and see you in future posts!
[&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/delivery-as-code-with-azure-devops-release-engine/1_BCiLLad3dvZLwBa-B5cAVQ.png"
loading="lazy"
alt="Image"
>
](&lt;a class="link" href="https://faun.to/bP1m5" target="_blank" rel="noopener"
>https://faun.to/bP1m5&lt;/a>)&lt;/p>
&lt;p>Join FAUN: &lt;a class="link" href="https://faun.to/i9Pt9" target="_blank" rel="noopener"
>&lt;strong>Website&lt;/strong>&lt;/a>** &lt;strong>💻&lt;/strong>|&lt;strong>&lt;a class="link" href="https://faun.dev/podcast" target="_blank" rel="noopener"
>&lt;strong>Podcast&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🎙️&lt;/strong>|&lt;strong>&lt;a class="link" href="https://twitter.com/joinfaun" target="_blank" rel="noopener"
>&lt;strong>Twitter&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🐦&lt;/strong>|&lt;strong>&lt;a class="link" href="https://www.facebook.com/faun.dev/" target="_blank" rel="noopener"
>&lt;strong>Facebook&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>👥&lt;/strong>|&lt;strong>&lt;a class="link" href="https://instagram.com/fauncommunity/" target="_blank" rel="noopener"
>&lt;strong>Instagram&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>📷|&lt;a class="link" href="https://www.facebook.com/groups/364904580892967/" target="_blank" rel="noopener"
>&lt;strong>Facebook Group&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>🗣️&lt;/strong>|&lt;strong>&lt;a class="link" href="https://www.linkedin.com/company/faundev" target="_blank" rel="noopener"
>&lt;strong>Linkedin Group&lt;/strong>&lt;/a>&lt;/strong> &lt;strong>💬&lt;/strong>|** &lt;a class="link" href="https://faun.dev/chat" target="_blank" rel="noopener"
>&lt;strong>Slack&lt;/strong>&lt;/a> 📱&lt;strong>|&lt;/strong>&lt;a class="link" href="https://thechief.io" target="_blank" rel="noopener"
>&lt;strong>Cloud Native&lt;/strong> &lt;strong>News&lt;/strong>&lt;/a>** &lt;strong>📰&lt;/strong>|&lt;strong>&lt;a class="link" href="https://linktr.ee/faun.dev/" target="_blank" rel="noopener"
>&lt;strong>More&lt;/strong>&lt;/a>&lt;/strong>.**&lt;/p>
&lt;p>&lt;strong>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇&lt;/strong>&lt;/p></description></item><item><title>How to extend an Azure DevOps YAML Pipeline Template</title><link>http://www.wesleycamargo.com/p/how-to-extend-an-azure-devops-yaml-pipeline-template/</link><pubDate>Thu, 30 Dec 2021 17:28:36 +0100</pubDate><guid>http://www.wesleycamargo.com/p/how-to-extend-an-azure-devops-yaml-pipeline-template/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/how-to-extend-an-azure-devops-yaml-pipeline-template/1_8JQMH109KuJHKrUubmjxqA.jpeg" alt="Featured image of post How to extend an Azure DevOps YAML Pipeline Template" />&lt;h3 id="how-to-extend-an-azure-devops-yaml-pipelinetemplate">How to extend an Azure DevOps YAML Pipeline Template
&lt;/h3>&lt;p>If you need to control what is allowed during your deployment, extending the YAML Templates is the easiest way to know what is being done on your deployments.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-extend-an-azure-devops-yaml-pipeline-template/1_8JQMH109KuJHKrUubmjxqA.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@zonduurzaam?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Zonduurzaam Deventer&lt;/a> on &lt;a class="link" href="https://unsplash.com/s/photos/power-strip?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;h3 id="azure-devops-yaml-templates">Azure DevOps YAML Templates
&lt;/h3>&lt;p>YAML Templates are the smartest way to create your pipelines. It allows you to break down the pipelines into small pieces reusing your logic, which leads to some best practices as &lt;em>Don&amp;rsquo;t Repeat Yourself &lt;em>and&lt;/em> Dependency Inversion.&lt;/em>&lt;/p>
&lt;p>It’s also possible to use the *Declarative *instead of the &lt;em>Imperative&lt;/em> approach, therefore who will consume your pipelines does not need to know the details of how to deploy an application, but just say what is necessary to deploy.&lt;/p>
&lt;p>With these principles being correctly applied, it is possible to build a reliable and robust way to deploy new applications, but who will consume it doesn’t need to be a DevOps expert.&lt;/p>
&lt;h3 id="creating-an-azure-devops-yaml-templates">Creating an Azure DevOps YAML Templates
&lt;/h3>&lt;h4 id="parameters-on-azure-devops-yaml-templates">Parameters on Azure DevOps YAML Templates
&lt;/h4>&lt;p>On top of the template, the first section is &lt;code>parameters&lt;/code> . As our goal is to make the templates reusable, makes complete sense to have a way to change values according to which application is consuming the template. To keep it simple in this example, it was parametrized the application name.&lt;/p>
&lt;p>`ash
parameters:&lt;/p>
&lt;ul>
&lt;li>name: applicationName
type: string
`&lt;/li>
&lt;/ul>
&lt;h4 id="stages-on-azure-devops-yaml-templates">Stages on Azure DevOps YAML Templates
&lt;/h4>&lt;p>To have an extendible template, it must be created on the level of the stages. This example has two of them, one for build and one more for development environment. 
Below you can check the full template script:&lt;/p>
&lt;h3 id="extending-azure-devops-yaml-templates">Extending Azure DevOps YAML Templates
&lt;/h3>&lt;h4 id="configuring-triggers-on-azure-devops-yaml-templates">Configuring triggers on Azure DevOps YAML Templates
&lt;/h4>&lt;p>On top of the consumer file, in our case &lt;code>azure-pipelines.yml&lt;/code> , we need to declare the triggers of the pipeline. It is mandatory to include at least one value for branch(it can be * if needed), or &lt;code>none&lt;/code> . You can also set the path where your files are, and your pipeline will run only when those files change.&lt;/p>
&lt;p>&lt;code>ash trigger: branches: include: - main - develop paths: include: - src/* &lt;/code>&lt;/p>
&lt;h4 id="referencing-azure-devops-yaml-templates">Referencing Azure DevOps YAML Templates
&lt;/h4>&lt;p>To extend a template, you need to provide the relative path for your template file. In this example, there is a &lt;code>templates&lt;/code> directory with the file &lt;code>template.yml&lt;/code> so on the consumer file, it’s necessary to provide the template path in the format &lt;code>./templates/template.yml&lt;/code> &lt;code>.&lt;/code>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-extend-an-azure-devops-yaml-pipeline-template/1_PKHTHZN9K5hkDjgXRZ7mzQ.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;p>We also need to provide the parameter defined in our template. To this, you just need to add the parameters section right below the template, the name of the parameter, and of course, the value for it. Below there is the complete “consumer” file.&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>In this post, I introduced the basic concepts of how to extend Azure DevOps YAML Pipelines. This is easy to implement but can yield good fruits in future implementations.&lt;/p>
&lt;p>In future articles, I will deep dive into this subject and show the full potential of this approach :).&lt;/p></description></item><item><title>How to suppress warning and error messages in Azure CLI</title><link>http://www.wesleycamargo.com/p/how-to-suppress-warning-and-error-messages-in-azure-cli/</link><pubDate>Mon, 20 Dec 2021 09:02:01 +0100</pubDate><guid>http://www.wesleycamargo.com/p/how-to-suppress-warning-and-error-messages-in-azure-cli/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/how-to-suppress-warning-and-error-messages-in-azure-cli/0_CRHG3CI34LabcOV4.jpeg" alt="Featured image of post How to suppress warning and error messages in Azure CLI" />&lt;h3 id="how-to-suppress-warning-and-error-messages-in-azurecli">How to suppress warning and error messages in Azure CLI
&lt;/h3>&lt;h4 id="in-azure-cli-some-commands-can-return-errors-and-warning-messages-which-can-cause-troubles-on-your-script-so-check-out-how-to-suppressit">In Azure CLI some commands can return errors and warning messages, which can cause troubles on your script, so check out how to suppress it
&lt;/h4>&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-suppress-warning-and-error-messages-in-azure-cli/0_CRHG3CI34LabcOV4.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@ahsanjaya?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Muhammad Daudy&lt;/a> on &lt;a class="link" href="https://unsplash.com/s/photos/warning?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;h3 id="how-to-suppress-warnings-on-azurecli">How to suppress warnings on Azure CLI
&lt;/h3>&lt;h4 id="command-group-is-in-preview-and-under-development">Command group is in preview and under development
&lt;/h4>&lt;p>In some cases the CLI used can be under development and show the message: &lt;code>Command group is in preview and under development. Reference and support levels: [https://aka.ms/CLI_refstatus](https://aka.ms/CLI_refstatus)&lt;/code>&lt;/p>
&lt;p>At the moment that I am writing this post, the az devops CLI variable-group for example is always returning the message above, which have been causing troubles and breaking my pester tests :)&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-suppress-warning-and-error-messages-in-azure-cli/0_SHfQUJPYn9MuJ-i3.png"
loading="lazy"
alt="Image"
>
Photo prepared by author&lt;/p>
&lt;h4 id="quiet-mode-on-azurecli">Quiet mode on Azure CLI
&lt;/h4>&lt;p>For Azure CLI, the simplest way to make the commands “quiet” is by adding the global parameter &lt;code>--only-show-errors&lt;/code> in your command. **It will suppress only the warnings **and keep the message in case you have any errors during the execution.&lt;/p>
&lt;p>So in our example for &lt;code>az pipelines variable-group&lt;/code> our command will be like this:&lt;/p>
&lt;p>&lt;code>ash az pipelines variable-group list --org $organization -p $project --only-show-errors &lt;/code>&lt;/p>
&lt;h3 id="how-to-suppress-errors-on-azurecli">How to suppress errors on Azure CLI
&lt;/h3>&lt;p>In some cases, you may need to also suppress the errors during your script execution and there is one more option for it. I would recommend this approach only if you really do not care if something went wrong during your script execution.&lt;/p>
&lt;h3 id="redirecting-the-console-outputstderr">Redirecting the console output STDERR
&lt;/h3>&lt;p>A common scenario to redirect streams is when the symbol &lt;code>&amp;gt;&lt;/code> is used to write the output of the command in a file. It redirects the standard output - STDOUT - to the file added as a parameter.&lt;/p>
&lt;p>In the situation that is necessary to suppress the errors, we need to redirect the output of the error stream — STDERR.&lt;/p>
&lt;p>To do it you simply need to add &lt;code>2&amp;gt;nul&lt;/code> after the CLI command, which means that the second stream (STDERR) will be redirected to &lt;code>null&lt;/code> .&lt;/p>
&lt;p>So in our example for &lt;code>az pipelines variable-group&lt;/code> the command will be:&lt;/p>
&lt;p>&lt;code>ash az pipelines variable-group list --org $organization -p $project 2&amp;gt;nul &lt;/code>&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Although this topic looks simple, sometimes it’s not so easy to find this information in the documentation, especially regarding the error suppressing topic, and also the comparison of both approaches is not documented.&lt;/p>
&lt;p>I grouped both, how to suppress warnings and errors in one place, so would be to choose which option suits better in each scenario.&lt;/p>
&lt;h3 id="references">References
&lt;/h3>&lt;p>&lt;a class="link" href="https://docs.microsoft.com/en-us/troubleshoot/cpp/redirecting-error-command-prompt" target="_blank" rel="noopener"
>Redirecting error from Command Prompt — Visual C++ | Microsoft Docs&lt;/a>&lt;/p>
&lt;p>&lt;a class="link" href="https://github.com/Azure/azure-cli/issues/13384" target="_blank" rel="noopener"
>https://github.com/Azure/azure-cli/issues/13384&lt;/a>&lt;/p></description></item><item><title>Creating Azure Databricks with Bicep and Azure DevOps YAML Pipelines</title><link>http://www.wesleycamargo.com/p/creating-azure-databricks-with-bicep-and-azure-devops-yaml-pipelines/</link><pubDate>Fri, 20 Aug 2021 19:45:12 +0200</pubDate><guid>http://www.wesleycamargo.com/p/creating-azure-databricks-with-bicep-and-azure-devops-yaml-pipelines/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/creating-azure-databricks-with-bicep-and-azure-devops-yaml-pipelines/1_q45YY42etgKPognuoFZJmA.jpeg" alt="Featured image of post Creating Azure Databricks with Bicep and Azure DevOps YAML Pipelines" />&lt;h3 id="creating-azure-databricks-with-bicep-and-azure-devops-yaml-pipelines">Creating Azure Databricks with Bicep and Azure DevOps YAML Pipelines
&lt;/h3>&lt;h4 id="continuing-the-dataops-automation-series-in-this-post-i-will-demonstrate-how-to-create-your-databricks-workspace-using-infrastructure-as-code-with-bicep-and-azure-devops-yaml-pipelines-to-deploy-it-in-azure-lets-check-itout">Continuing the DataOps Automation series, in this post I will demonstrate how to create your Databricks workspace using Infrastructure as Code with Bicep and Azure DevOps YAML Pipelines to deploy it in Azure. Let’s check it out!
&lt;/h4>&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-azure-databricks-with-bicep-and-azure-devops-yaml-pipelines/1_q45YY42etgKPognuoFZJmA.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@benjopen?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Benjamin Jopen&lt;/a> on &lt;a class="link" href="https://unsplash.com/s/photos/brick-construction?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;p>In the previous articles, you can check how to&lt;a class="link" href="https://towardsdatascience.com/dataops-automation-creating-azure-data-factory-with-git-integration-using-bicep-376fd3b5bc81" target="_blank" rel="noopener"
> create an Azure Data Factory with git integration using Bicep&lt;/a> and also the &lt;a class="link" href="https://towardsdatascience.com/azure-data-factory-ci-cd-made-simple-building-and-deploying-your-arm-templates-with-azure-devops-30c30595afa5" target="_blank" rel="noopener"
>easiest way to create a CI/CD pipeline for Azure Data Factory&lt;/a>&lt;/p>
&lt;p>At the end of the post, you can check a complete YAML pipeline read to be used!&lt;/p>
&lt;h3 id="what-is-a-bicep-template">What is a Bicep template?
&lt;/h3>&lt;p>If you are not familiar with Bicep, this is a DSL for the ARM Templates, that has a cleaner syntax, better support to modules, and other great features. It also has a nice &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/quickstart-create-bicep-use-visual-studio-code?tabs=CLI&amp;amp;WT.mc_id=devops-34401-jagord" target="_blank" rel="noopener"
>Visual Studio Code extension &lt;/a>that helps a lot in building templates from scratch.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-azure-databricks-with-bicep-and-azure-devops-yaml-pipelines/0_FsceF8fsND7cZ2BM.png"
loading="lazy"
alt="Image"
>
Nice extension for Visual Studio Code! — Image from &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/install#development-environment" target="_blank" rel="noopener"
>Microsoft Docs&lt;/a>&lt;/p>
&lt;p>When you run a deployment using a bicep template, it transpile the file and generates a native ARM Template, similar to what happens between Typescript and Javascript.&lt;/p>
&lt;p>If you want to learn more about it, check the official documentation &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/overview" target="_blank" rel="noopener"
>here&lt;/a>.&lt;/p>
&lt;h3 id="creating-the-infrastructure-as-code-for-azure-databricks">Creating the Infrastructure as Code for Azure Databricks
&lt;/h3>&lt;h4 id="creating-a-resource-group-with-azurecli">Creating a Resource Group with Azure CLI
&lt;/h4>&lt;p>To deploy our Databricks workspace we need to have a Resource Group created in your Azure Subscription. The easiest way to do that is through Azure CLI. To do that you need to log in with the command &lt;code>az login&lt;/code> and then run the following command:&lt;/p>
&lt;p>az group create -name RG-Databricks -location northeuropeReplace the parameters name and location for those that best suit your needs.&lt;/p>
&lt;h4 id="creating-bicep-templates-for-azure-databricks">Creating Bicep templates for Azure Databricks
&lt;/h4>&lt;p>The Bicep template for Azure Databricks it’s quite simple and has 4 main sections:&lt;/p>
&lt;p>&lt;strong>Parameters:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>Workspace Name: If you do not provide a value, it uses a &lt;code>uniqueString&lt;/code> function, which ensures that it will always be the same, as this is based on the resource group id.&lt;/li>
&lt;li>Location: By default, this is using the resource group location&lt;/li>
&lt;li>SKU: The default value is trial, so be sure to replace it in your real-life scenario ;).&lt;/li>
&lt;/ul>
&lt;p>**Variables: **The template also has the variable &lt;code>managedResourceGroupName&lt;/code> . This resource group will be managed by Azure Databricks to create your clusters later on.&lt;/p>
&lt;p>**Resources: **Here we have only one resource that is the Databrics Workspace. This is consuming the API version &lt;code>2018–04–01&lt;/code> .&lt;/p>
&lt;p>**Output: **This section contains the variables that you need to expose. It means that they can be accessed by other processes later on in your deployment process.&lt;/p>
&lt;h3 id="deploying-bicep-with-azure-devops-yaml-pipelines">Deploying Bicep with Azure DevOps YAML Pipelines
&lt;/h3>&lt;h4 id="building-biceptemplate">Building Bicep Template
&lt;/h4>&lt;p>As I said before, it is possible to “build” the Bicep template transpiling it into an ARM Template. So to ensure that our template is valid, let’s do it!&lt;/p>
&lt;p>To build it, you will also use the Azure CLI. The command is also quite simple:&lt;/p>
&lt;p>az bicep build &amp;ndash;file &lt;your file> &amp;ndash;outdir &lt;your directory>To create an Azure DevOps YAML Pipeline, we will run the command above in an AzureCLI task:&lt;/p>
&lt;p>After transpile the Bicep into ARM Template, it will deploy as a Deployment Artefact read to be consumed:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-azure-databricks-with-bicep-and-azure-devops-yaml-pipelines/1_GhTEFX4p8uW0MOolGJJRsQ.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/creating-azure-databricks-with-bicep-and-azure-devops-yaml-pipelines/1_GsfTVy6oBm0Deal_YVFUcw.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;p>Build your Bicep is a good practice, as you can validate that there is no error in it and gather all necessary files to be deployed.&lt;/p>
&lt;h4 id="deploying-bicep-with-yaml-pipelines">Deploying Bicep with YAML Pipelines
&lt;/h4>&lt;p>With the artifacts generated in the build step, now we are ready to deploy them in our environment. For that it is necessary to add one more stage into the build YAML, with the instruction to run the ARM Template:&lt;/p>
&lt;p>It consumes the task &lt;code>AzureResourceManagerTemplateDeployment@3&lt;/code> that is responsible to run the ARM Template into Azure Subscription. You can have more information about this task &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops" target="_blank" rel="noopener"
>here&lt;/a>.&lt;/p>
&lt;p>This stage represents the development stage. To deploy it in other environments, you just need to copy it and replace the values according to your environments :)&lt;/p>
&lt;h3 id="real-lifeexample">Real life example
&lt;/h3>&lt;p>To check these examples in more realistic situations, I have been working in a GitHub repository with examples of pipelines configured and working. You can check that in the DevOps Nights GitHub here: &lt;a class="link" href="https://github.com/devopsnights/azuredevops-yaml-quickstart-templates" target="_blank" rel="noopener"
>devopsnights/azuredevops-yaml-quickstart-templates (github.com)&lt;/a>&lt;/p>
&lt;h3 id="databricks-yamlpipeline">Databricks YAML Pipeline
&lt;/h3>&lt;p>As promised below you can check a full Azure DevOps YAML Pipeline configured and working:&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Bicep has become a very relevant tool for Azure and has a good potential to be the default tool for Infrastructure as Code in Azure. So start to be familiar with it now, will be very relevant in the future :)&lt;/p>
&lt;p>I hope this post could help you, and see you in the next post!&lt;/p></description></item><item><title>Azure Data Factory CI-CD made simple: Building and deploying ARM templates with Azure DevOps YAML…</title><link>http://www.wesleycamargo.com/p/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/</link><pubDate>Fri, 13 Aug 2021 18:24:55 +0200</pubDate><guid>http://www.wesleycamargo.com/p/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/0_UxUKOY8oNniMGGHd.png" alt="Featured image of post Azure Data Factory CI-CD made simple: Building and deploying ARM templates with Azure DevOps YAML…" />&lt;h3 id="azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml-pipelines">Azure Data Factory CI-CD made simple: Building and deploying ARM templates with Azure DevOps YAML Pipelines
&lt;/h3>&lt;h4 id="the-easiest-way-to-publishdeploy-azure-data-factory-artifacts">The easiest way to publish/deploy Azure Data Factory artifacts
&lt;/h4>&lt;h3 id="how-to-create-azure-data-factory-usingiac">How to Create Azure Data Factory using IaC
&lt;/h3>&lt;h4 id="infrastructure-ascode">Infrastructure as Code
&lt;/h4>&lt;p>There are tons of reasons to use IaC in your projects, as you can check &lt;a class="link" href="https://docs.microsoft.com/en-us/devops/deliver/what-is-infrastructure-as-code#:~:text=Infrastructure%20as%20Code%20enables%20DevOps,to%20prevent%20common%20deployment%20issues." target="_blank" rel="noopener"
>here&lt;/a>. One of them is that Infrastructure as Code is the easiest and fast way to implement your environment. So, as we want to keep our ADF deployment simple, why not use it :)?&lt;/p>
&lt;p>In this example, I will use &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/overview" target="_blank" rel="noopener"
>Bicep &lt;/a>templates to deploy our Data Factory. If Bicep is new to you, it is basically a DSL (Domain Specific Language) to make things easier for ARM Templates users.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/0_UxUKOY8oNniMGGHd.png"
loading="lazy"
alt="Image"
>
Bicep is has a good extension for VS Code— Image from &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/install#development-environment" target="_blank" rel="noopener"
>Microsoft Docs&lt;/a>&lt;/p>
&lt;p>In this &lt;a class="link" href="https://camargo-wes.medium.com/dataops-automation-creating-azure-data-factory-with-git-integration-using-bicep-376fd3b5bc81" target="_blank" rel="noopener"
>post&lt;/a>, you can check how to create the Bicep file for Data Factory with git integration that will be used to deploy the ADF.&lt;/p>
&lt;p>It will create a link between your Azure Data Factory and your git repo (it works on Azure DevOps and GitHub), so when you create a pipeline in your Data Factory, it will also be versioned into the git repo.&lt;/p>
&lt;h3 id="git-repository">Git Repository
&lt;/h3>&lt;h4 id="repository-structure">Repository Structure
&lt;/h4>&lt;p>The repo structure will depend on each project. One of the best practices is to keep all necessary code to deploy a project in the same repo. Due to that, I like to create a structure where I have the name of the component, and always an “src” folder underneath. In this case, we will make the src folder as “Root folder” in the git integration process.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_YtAqSUP9bqM4NyrMgs3UIw.png"
loading="lazy"
alt="Image"
>
Repository Structure — Image by author&lt;/p>
&lt;h4 id="required-files-to-build-arm-templates">Required files to build ARM Templates
&lt;/h4>&lt;p>Some files are necessary to have in our repo to generate the templates. These files need to be added to the src folder, and they will be referenced during the build stage.&lt;/p>
&lt;p>In the src folder create the file package.json. It contains the metadata of the package that will be used to build the ADF Artifacts.&lt;/p>
&lt;p>In the same folder also create the file publish_config.json with the content below. It will not impact the generation of the ARM Templates, but it’s necessary to run the build:&lt;/p>
&lt;p>The last file is arm-template-parameters-definition.json. This contains the definitions of your ARM Parameters. I won’t go into details, as it requires a dedicated post for it. For the initial version, you can just create the content below:&lt;/p>
&lt;p>After create git integrate and all necessary files this is how your repo will look like:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_xesC9GvPVvyOeHafv6EvXg.png"
loading="lazy"
alt="Image"
>
Repository structure for Azure Data Factory — Image by author&lt;/p>
&lt;h3 id="how-to-create-build-yaml-pipelines-for-azure-datafactory">How to create Build YAML Pipelines for Azure Data Factory
&lt;/h3>&lt;p>No doubt that pipeline as code will be the future of pipeline definitions, with the capacity to be under version control and reusability.&lt;/p>
&lt;h4 id="variables">Variables
&lt;/h4>&lt;p>The first configuration that is necessary is the variables. They will be used both for build and release later on.&lt;/p>
&lt;p>The most important variables during the build stage are:&lt;/p>
&lt;ul>
&lt;li>workingDir - This is the src directory. There must be the required files mentioned above.&lt;/li>
&lt;li>dataFactoryResourceId - Fill this with the resource Id of your ADF. It’s a good idea to make it parametrizable to work in different environments&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_Y8FG1YgQAtQCCysOutYifw.png"
loading="lazy"
alt="Image"
>
Build and Deployment Variables — Image by author&lt;/p>
&lt;h4 id="building-datafactory">Building Data Factory
&lt;/h4>&lt;p>As mentioned above, we need to consume the &lt;a class="link" href="https://www.npmjs.com/package/@microsoft/azure-data-factory-utilities" target="_blank" rel="noopener"
>ADFUtilities NPM package&lt;/a> in the build process.&lt;/p>
&lt;p>In the first two tasks, NodeJS is configured in the build agent. Pay attention to workingDir variable that we mentioned in the Variables section.&lt;/p>
&lt;p>In the latest two tasks, we are calling the NPM package to Validate and “Build” our Data Factory and Generate the ARM Templates. In the last task “artifacts” is the relative output directory. It means that it will be the output directory to the ARM Templates.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_hxff1a4SfxpSRAKGjak-7A.png"
loading="lazy"
alt="Image"
>
Build tasks for Azure Data Factory — Image by author&lt;/p>
&lt;p>In the next tasks, we are copying the ARM Templates from the output to the staging directory, and “building“ the bicep files into ARM Templates. These ones will be used to create the Azure Data Factory Workspace.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_FzU20QATViUliVFKaujdlw.png"
loading="lazy"
alt="Image"
>
Build tasks for Azure Data Factory — Image by author&lt;/p>
&lt;p>After running the build pipeline, you will have the artifacts that will be consumed during the deployment stage:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_xLM1sqP0zF8ToLhmWy84bA.png"
loading="lazy"
alt="Image"
>
Azure Data Factory artifacts — Image by author&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_KokLuIz66bVH_C8D9MqvGA.png"
loading="lazy"
alt="Image"
>
Azure Data Factory ARM Templates — Image by author&lt;/p>
&lt;h3 id="how-to-create-release-yaml-pipelines-for-azure-datafactory">How to create Release YAML Pipelines for Azure Data Factory
&lt;/h3>&lt;p>To deploy Data Factory we are using the run Once strategy. It will consume the artifacts created on the build stage&lt;/p>
&lt;h4 id="development">Development
&lt;/h4>&lt;p>When the git integration is enabled in development environment, as the code is produced in the workspace, there is no need to publish in this environment. It will deploy only the environment using the Infrastructure as Code templates. It also contains a dependency for the build stage.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_1CyHziX8HIxTiFKWd1AHJw.png"
loading="lazy"
alt="Image"
>
Development environment — Image by author&lt;/p>
&lt;h4 id="uat-and-production">UAT and Production
&lt;/h4>&lt;p>In UAT we have a dependency on the development environment. In Production, the dependency is on UAT. As in these stages, we need to deploy both, infrastructure and code, we will use a preDeploy and deploy job:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_H7fXBNZIabhKW5BEoxT2Lw.png"
loading="lazy"
alt="Image"
>
preDeploy stage — Image by author&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_TK9afdqzBDdiE2m1791joQ.png"
loading="lazy"
alt="Image"
>
deploy stage — Image by Author&lt;/p>
&lt;p>When run it will first create the Infrastructure using the Bicep files in the preDeploy Stage, and then deploy the artifacts generated on the build stage. And this is the final result:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-data-factory-ci-cd-made-simple-building-and-deploying-arm-templates-with-azure-devops-yaml/1_D1TW--IjWUMr1c-TR5CNYQ.png"
loading="lazy"
alt="Image"
>
Deployment Pipeline — Image by Author&lt;/p>
&lt;h3 id="key-takeaways">Key Takeaways
&lt;/h3>&lt;p>There is more than one strategy to deploy Azure Data Factory, I have tried most of them and they work very well, but this one from my point of view is the simplest and clean way to achieve fully automated deployments.&lt;/p>
&lt;p>Below you can check the complete YAML used to deploy it. You can also check other Azure DevOps YAML Templates examples in my GitHub repo: &lt;a class="link" href="https://github.com/devopsnights/azuredevops-yaml-quickstart-templates" target="_blank" rel="noopener"
>devopsnights/azuredevops-yaml-quickstart-templates (github.com)&lt;/a>&lt;/p>
&lt;p>I hope it can be useful!&lt;/p></description></item><item><title>DataOps Automation — Creating Azure Data Factory with git integration using Bicep</title><link>http://www.wesleycamargo.com/p/dataops-automation-creating-azure-data-factory-with-git-integration-using-bicep/</link><pubDate>Sun, 25 Jul 2021 00:48:52 +0200</pubDate><guid>http://www.wesleycamargo.com/p/dataops-automation-creating-azure-data-factory-with-git-integration-using-bicep/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-creating-azure-data-factory-with-git-integration-using-bicep/1_HzDcdeTCGa9vVDuUQulXAQ.png" alt="Featured image of post DataOps Automation — Creating Azure Data Factory with git integration using Bicep" />&lt;h3 id="dataops-automationcreating-azure-data-factory-with-git-integration-usingbicep">DataOps Automation — Creating Azure Data Factory with git integration using Bicep
&lt;/h3>&lt;p>An important feature available in Azure Data Factory is the git integration, which allows us to keep Azure Data Factory artifacts under Source Control. This is a mandatory step to achieve Continuous Integration and Delivery later on, so why not configure this using Infrastructure as Code with Bicep in a fully automated way?&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-creating-azure-data-factory-with-git-integration-using-bicep/1_HzDcdeTCGa9vVDuUQulXAQ.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;p>In the &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/data-factory/source-control#advantages-of-git-integration" target="_blank" rel="noopener"
>official Microsoft documentation&lt;/a> there is a good topic explaining how to integrate Azure Data Factory with git, but through the Azure Portal. In this post, I will explain how to do that using Bicep, the new IaC language for Azure, to make it possible to include this step into your CI/CD process, and also how to deploy only on needed environments.&lt;/p>
&lt;h3 id="azure-data-factory-git-integration">Azure Data Factory Git integration
&lt;/h3>&lt;p>Okay, but why do I need to use git on my ADF? To explain this, I’ll list some advantages that the git integration offers, taken from &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/data-factory/source-control#advantages-of-git-integration" target="_blank" rel="noopener"
>Microsoft’s documentation&lt;/a>:&lt;/p>
&lt;h4 id="source-control">&lt;strong>Source control&lt;/strong>
&lt;/h4>&lt;p>As your data factory workloads become crucial, you would want to integrate your factory with Git to leverage several source control benefits like the following:&lt;/p>
&lt;ul>
&lt;li>Ability to track/audit changes.&lt;/li>
&lt;li>Ability to revert changes that introduced bugs.&lt;/li>
&lt;/ul>
&lt;h4 id="partial-saves">&lt;strong>Partial saves&lt;/strong>
&lt;/h4>&lt;p>When authoring against the data factory service, you can’t save changes as a draft and all publish must pass data factory validation. Whether your pipelines are not finished or you simply don’t want to lose changes if your computer crashes, git integration allows for incremental changes of data factory resources regardless of what state they are in. Configuring a git repository allows you to save changes, letting you only publish when you have tested your changes to your satisfaction.&lt;/p>
&lt;h4 id="collaboration-andcontrol">Collaboration and control
&lt;/h4>&lt;p>If you have multiple team members contributing to the same factory, you may want to let your teammates collaborate with each other via a code review process. You can also set up your factory such that not every contributor has equal permissions. Some team members may only be allowed to make changes via Git and only certain people in the team are allowed to publish the changes to the factory.&lt;/p>
&lt;h4 id="better-cicd">Better CI/CD
&lt;/h4>&lt;p>If you are deploying to multiple environments with a &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/data-factory/continuous-integration-deployment" target="_blank" rel="noopener"
>continuous delivery process&lt;/a>, git integration makes certain actions easier. Some of these actions include:&lt;/p>
&lt;ul>
&lt;li>Configure your release pipeline to trigger automatically as soon as there are any changes made to your ‘dev’ factory.&lt;/li>
&lt;li>Customize the properties in your factory that are available as parameters in the Resource Manager template. It can be useful to keep only the required set of properties as parameters and have everything else hardcoded.&lt;/li>
&lt;/ul>
&lt;h4 id="better-performance">Better Performance
&lt;/h4>&lt;p>An average factory with git integration loads 10 times faster than one authoring against the data factory service. This performance improvement is because resources are downloaded via Git.&lt;/p>
&lt;h3 id="git-integration-is-only-for-development-environment">Git Integration is only for Development Environment
&lt;/h3>&lt;p>There are two flows recommended by Microsoft to perform CI/CD on ADF, (you can check it on &lt;a class="link" href="https://towardsdatascience.com/azure-data-factory-ci-cd-made-simple-building-and-deploying-your-arm-templates-with-azure-devops-30c30595afa5" target="_blank" rel="noopener"
>this post&lt;/a>), in both cases the development happens in the Development Data Factory workspace only, and the artifacts are promoted through CI/CD deployments. It means that we should not create this integration for non-dev environments like UAT or Production. I will also cover how to identify the environment and create the integration only for your development environment :)&lt;/p>
&lt;h3 id="creating-bicep-templates-for-azure-data-factory-step-bystep">Creating Bicep templates for Azure Data Factory step by step
&lt;/h3>&lt;p>To keep the explanation simple, I’ll show each stage of the bicep file. Each stage is a deployable file that you can execute individually with the command&lt;/p>
&lt;p>*az deployment group create -f &lt;your file>.bicep -g &lt;your resource group>*In the end, we will have the complete file ready to use.&lt;/p>
&lt;h4 id="creating-data-factory-workspace">Creating Data Factory Workspace
&lt;/h4>&lt;p>In the first stage, we are creating only the workspace with the most basic configurations. You can see that for the location we are using the location of the Resource Group where we are executing this deployment.&lt;/p>
&lt;h4 id="linking-github-with-azure-datafactory">Linking GitHub with Azure Data Factory
&lt;/h4>&lt;p>In this stage we achieve the first goal of this post: create the **git integration. **I include the parameters necessary to connect with a GitHub repo, and then a section into “properties”. Now lets check the parameters:&lt;/p>
&lt;ul>
&lt;li>**accountName &lt;strong>-&lt;/strong> **This is your GitHub/Azure DevOps account name.&lt;/li>
&lt;li>**repositoryName **- Name of your repository, pay attention that you don’t need your account name at the beginning.&lt;/li>
&lt;li>**collaborationBranc **- The branch that will be used to integrate your feature branches. It will depend on your branch stratety. For git flow, it should be developed branch, for GitHub Flow, master/main.&lt;/li>
&lt;li>**rootFolder **- The folder in your repo where the databricks artifacts will be versioned.&lt;/li>
&lt;li>&lt;strong>projectName&lt;/strong> - This parameter is only used for Azure DevOps. It’s the Team Project name of your repo.&lt;/li>
&lt;li>**type **- This parameter defines if your repo is hosted on GitHub or Azure DevOps. For GitHub, the value must be:&lt;/li>
&lt;/ul>
&lt;p>FactoryGitHubConfigurationFor Azure Devops the value is:&lt;/p>
&lt;p>&lt;code>ash FactoryVSTSConfiguration &lt;/code>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-creating-azure-data-factory-with-git-integration-using-bicep/1_kPiiBIbO9dRU8xDRdSdOmg.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;h4 id="checking-the-environments">Checking the environments
&lt;/h4>&lt;p>As was explained above, we must create git integration in the development environment only. If you are using only GitHub or only Azure DevOps, this stage should be enough for your scenario. To check that, we need the following steps:&lt;/p>
&lt;ul>
&lt;li>An environment parameter.&lt;/li>
&lt;li>Extract the content of &lt;strong>repoConfiguration&lt;/strong> to an external variable.&lt;/li>
&lt;li>Use a ternary if to check if the environment provided is development. If it is, then use the variable, if not, use an empty group.&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-creating-azure-data-factory-with-git-integration-using-bicep/1_sR-iArVHnrubuSbaaH4a4A.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;p>The bicep file of this stage:&lt;/p>
&lt;h4 id="linking-github-or-azure-devops-to-azure-datafactory">Linking GitHub or Azure DevOps to Azure Data Factory
&lt;/h4>&lt;p>In case that in your scenario you have both Azure DevOps and GitHub, you can prepare your template to support that. This template is more flexible and can be used in more situations. Let’s check the differences from the previous one:&lt;/p>
&lt;ul>
&lt;li>Included a “User Friendly” parameter to indicate the type of the repo.&lt;/li>
&lt;li>Check the type parameter and create a variable with the expected value.&lt;/li>
&lt;li>Create two configurations, one for GitHub and one for Azure DevOps.&lt;/li>
&lt;li>Include another ternary if nested into the first one&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-creating-azure-data-factory-with-git-integration-using-bicep/1_axZ5TeO8PChLhDkzhOEbhA.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;p>Below you can check the final bicep template:&lt;/p>
&lt;h3 id="real-lifeexample">Real life example
&lt;/h3>&lt;p>To check these examples in more realistic situations, I have been working in a repository in GitHub with examples of pipelines configured and working. You can check that in the DevOps Nights GitHub here: &lt;a class="link" href="https://github.com/devopsnights/azuredevops-yaml-quickstart-templates" target="_blank" rel="noopener"
>devopsnights/azuredevops-yaml-quickstart-templates (github.com)&lt;/a>&lt;/p>
&lt;p>In &lt;a class="link" href="https://towardsdatascience.com/azure-data-factory-ci-cd-made-simple-building-and-deploying-your-arm-templates-with-azure-devops-30c30595afa5" target="_blank" rel="noopener"
>this post&lt;/a>, I am showing how to consume this Bicep Template into an Azure DevOps Pipeline.&lt;/p>
&lt;p>I hope this post can help you to create your ADF in a more automated way, and see you in the next post!&lt;/p>
&lt;h4 id="references">References
&lt;/h4>&lt;p>&lt;a class="link" href="https://docs.microsoft.com/en-us/azure/data-factory/source-control#advantages-of-git-integration" target="_blank" rel="noopener"
>Source control — Azure Data Factory | Microsoft Docs&lt;/a>&lt;/p>
&lt;p>&lt;a class="link" href="https://docs.microsoft.com/en-us/rest/api/datafactory/factories/configure-factory-repo#factoryvstsconfiguration" target="_blank" rel="noopener"
>Factories — Configure Factory Repo — REST API (Azure Data Factory) | Microsoft Docs&lt;/a>&lt;/p>
&lt;p>&lt;a class="link" href="https://docs.microsoft.com/en-us/azure/templates/microsoft.datafactory/factories?tabs=json" target="_blank" rel="noopener"
>Microsoft.DataFactory/factories 2018–06–01 — ARM template reference | Microsoft Docs&lt;/a>&lt;/p></description></item><item><title>DataOps Automation — Deploying Databricks notebooks with Azure DevOps YAML Pipelines</title><link>http://www.wesleycamargo.com/p/dataops-automation-deploying-databricks-notebooks-with-azure-devops-yaml-pipelines/</link><pubDate>Tue, 15 Jun 2021 18:54:07 +0200</pubDate><guid>http://www.wesleycamargo.com/p/dataops-automation-deploying-databricks-notebooks-with-azure-devops-yaml-pipelines/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-deploying-databricks-notebooks-with-azure-devops-yaml-pipelines/1_7aLnpcc0eKFY3hptjG5W4Q.png" alt="Featured image of post DataOps Automation — Deploying Databricks notebooks with Azure DevOps YAML Pipelines" />&lt;h3 id="dataops-automationdeploying-databricks-notebooks-with-azure-devops-yaml-pipelines">DataOps Automation — Deploying Databricks notebooks with Azure DevOps YAML Pipelines
&lt;/h3>&lt;p>In this post, I will show an easy way how to deploy your Databricks notebooks using Azure DevOps and YAML pipelines.&lt;/p>
&lt;p>This will be the first of a series of posts, showing how to deploy code and infrastructure of Data Platform tools. I created GitHub repo to keep the examples, so if you want you can check that here: &lt;a class="link" href="https://github.com/wesleycamargo/DataOps" target="_blank" rel="noopener"
>wesleycamargo/DataOps (github.com)&lt;/a> 🙂&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-deploying-databricks-notebooks-with-azure-devops-yaml-pipelines/1_7aLnpcc0eKFY3hptjG5W4Q.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;h4 id="project-structure">Project structure
&lt;/h4>&lt;p>The organization of this repo is based on components, so I’ll keep everything necessary to deploy some kind of component together. If you have a different structure, remember to update the yaml templates with your paths.&lt;/p>
&lt;p>For databricks we have a &lt;code>/databricks&lt;/code> and a &lt;code>/src&lt;/code> folder, in the future it will be important to segregate from IaC code. You can have your project folders on this level, in my example, I have two notebooks inside a &lt;code>calculator&lt;/code> folder`.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-deploying-databricks-notebooks-with-azure-devops-yaml-pipelines/1_v-4dZZgIV3rrRXiZe6jcOA.png"
loading="lazy"
alt="Image"
>
Project structure — Image prepared by author&lt;/p>
&lt;h4 id="preparing-artifacts">Preparing artifacts
&lt;/h4>&lt;p>In the build stage, we will create a copy of our notebooks into a staging folder, and then publish them as build artifacts to be consumed later in the process.&lt;/p>
&lt;p>We will copy all folders under &lt;code>/src&lt;/code> folder, so when we deploy that into databricks workspace all folders will be created into the workspace as well.&lt;/p>
&lt;p>If you run the pipeline now you already can see the artifacts and the structure:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-deploying-databricks-notebooks-with-azure-devops-yaml-pipelines/1_zBile6BF8zXBHNK78lqPRQ.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;h4 id="setting-variables">Setting variables
&lt;/h4>&lt;p>In the deployment stage, we will need to consume some sensitive information like your databricks Personal Access Token. To avoid hard coding this information and to keep this example simple, let&amp;rsquo;s create some variables in the pipeline.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-deploying-databricks-notebooks-with-azure-devops-yaml-pipelines/1_YZkUdlCrfAwCZKOyL_Wo_g.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-deploying-databricks-notebooks-with-azure-devops-yaml-pipelines/1_igdByvqLq-3bKW2Pvnl7JA.png"
loading="lazy"
alt="Image"
>
Image prepared by author&lt;/p>
&lt;h4 id="deploy">Deploy
&lt;/h4>&lt;p>To deploy we will use a special kind of job called &lt;code>deployment &lt;/code>🙂, there are some advantages to use this instead of the regular job, but I’ll do not explore them now.&lt;/p>
&lt;p>In the first step, we are setting up the python version to 3.x, to that we are using a task to abstract this activity.&lt;/p>
&lt;p>In the second one, we are setting app our databricks workspace. Basically, we are creating a &lt;code>.databrickscfg&lt;/code> file with your token and databricks URL. To populate this file we need to consume the variables created before. So be sure that you have &lt;code>databricks.host&lt;/code> and &lt;code>databricks.token&lt;/code> create. We are also installing the databricks CLI to run on the next step.&lt;/p>
&lt;p>And finally, in the last step we are importing the artifacts generated before using databricks CLI.&lt;/p>
&lt;p>Below you can see the complete YAML template.&lt;/p>
&lt;p>Hope that post can help you and see you in the next post! 😃&lt;/p></description></item><item><title>Azure Reports: Exporting Azure resources with Powershell and Azure CLI</title><link>http://www.wesleycamargo.com/p/azure-reports-exporting-azure-resources-with-powershell-and-azure-cli/</link><pubDate>Wed, 28 Apr 2021 17:31:36 +0200</pubDate><guid>http://www.wesleycamargo.com/p/azure-reports-exporting-azure-resources-with-powershell-and-azure-cli/</guid><description>&lt;img src="https://cdn-images-1.medium.com/max/800/0*ItDdV0YdZCjm5u5T" alt="Featured image of post Azure Reports: Exporting Azure resources with Powershell and Azure CLI" />&lt;h3 id="azure-reports-exporting-azure-resources-with-powershell-and-azurecli">Azure Reports: Exporting Azure resources with Powershell and Azure CLI
&lt;/h3>&lt;p>A common scenario when we work with DevOps and cloud is the need to export information about your resources. In this post, I’ll show the simplest way to extract that with the command line.&lt;/p>
&lt;p>&lt;img src="https://cdn-images-1.medium.com/max/800/0*ItDdV0YdZCjm5u5T"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>The idea of this post is to show the mechanism behind the extraction, I’ll run a simple command to recover the resources and choose some columns to export to a CSV file. You can use this as a base of more complex reports to handle properties, cross with other information, etc.&lt;/p>
&lt;p>The first step is to connect in our Azure Account using Azure CLI (you can also do it using Azure Powershell), and recover all resources in our subscription:&lt;/p>
&lt;p>Then we create an Array List to populate, iterate on the resources recovered above, and add the needed fields on the array:&lt;/p>
&lt;p>Now we create a file name based on date and time to export the populated array. In my case I’m using the Delimiter “;”, as in my favorite regionalization this is the default pattern for CSV files. If this is not your case, you can remove that parameter.&lt;/p>
&lt;p>This is the complete script, including the outputPath parameter:&lt;/p>
&lt;p>And this is the file exported:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/azure-reports-exporting-azure-resources-with-powershell-and-azure-cli/1_s2J6kTWmfhRKG0O86hqaHg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>This is the link for my GitHub repository, and the intention is to fill it with more complex reports :)&lt;/p>
&lt;p>&lt;a class="link" href="https://github.com/wesleycamargo/AzureReports" target="_blank" rel="noopener"
>https://github.com/wesleycamargo/AzureReports&lt;/a>&lt;/p>
&lt;p>See you in the next post!&lt;/p></description></item><item><title>Deploying a DotNet Core app in Azure Web App by command line</title><link>http://www.wesleycamargo.com/p/deploying-a-dotnet-core-app-in-azure-web-app-by-command-line/</link><pubDate>Thu, 07 Jan 2021 09:01:16 +0100</pubDate><guid>http://www.wesleycamargo.com/p/deploying-a-dotnet-core-app-in-azure-web-app-by-command-line/</guid><description>&lt;h3 id="deploying-a-dotnet-core-app-in-azure-web-app-by-commandline">Deploying a DotNet Core app in Azure Web App by command line
&lt;/h3>&lt;p>If you need to fast deploy your dotnet core App in Azure, but don’t want to configure an entire CI/CD Pipeline, check in this post on how to deploy it!&lt;/p>
&lt;p>To deploy the web app we will use a simple DotNet Core MVC application.&lt;/p>
&lt;p>First of all, let´s create some parameters to prepare our resources. We are using a random id to avoid create the resources with some existing name:&lt;/p>
&lt;p>To create the app, we will use an MVC Sample in the dotnet core templates. If you already have an existing project to deploy, skip the first line. We will prepare the publishing package with the dotnet core publish command and then zip it in a file:&lt;/p>
&lt;p>In Azure, we will create a resource group and an app service plan, that are pre reqs to run a WebApp.&lt;/p>
&lt;p>And finally, execute the deployment in the WebApp created above.&lt;/p></description></item><item><title>Save Money with Azure: Handling your resources with Azure Functions</title><link>http://www.wesleycamargo.com/p/save-money-with-azure-handling-your-resources-with-azure-functions/</link><pubDate>Sat, 01 Aug 2020 22:30:15 +0200</pubDate><guid>http://www.wesleycamargo.com/p/save-money-with-azure-handling-your-resources-with-azure-functions/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_VMDq41L7qXNa_uWH.png" alt="Featured image of post Save Money with Azure: Handling your resources with Azure Functions" />&lt;h4 id="one-of-the-incessant-things-when-we-use-cloud-providers-its-how-to-have-the-biggest-efficiency-with-our-resources-if-you-have-azure-virtual-machines-for-example-reduce-the-time-of-non-production-environments-stays-turned-on-to-12-hours-at-weekdays-can-reduce-your-bill-by67">ONE OF THE INCESSANT THINGS WHEN WE USE CLOUD PROVIDERS, IT’S HOW TO HAVE THE BIGGEST EFFICIENCY WITH OUR RESOURCES. IF YOU HAVE AZURE VIRTUAL MACHINES, FOR EXAMPLE, REDUCE THE TIME OF NON-PRODUCTION ENVIRONMENTS STAYS TURNED ON TO 12 HOURS AT WEEKDAYS CAN REDUCE YOUR BILL BY 67%.
&lt;/h4>&lt;h3 id="save-money-with-azure-handling-your-resources-with-azure-functions">Save Money with Azure: Handling your resources with Azure Functions
&lt;/h3>&lt;p>In fact, when a VM is created, there is an option for shutdown within the scheduled time, but it’s a bit limited, due to nonexistence of an option to startup the VMs, nor the option to do this for dependent VMs as a Domain Controller that should be online when the other VMs start.&lt;/p>
&lt;p>A good, simple, and cheaper solution for this, is to use an Azure Function to startup and shutdown the Virtual Machines. So let’s see how we can do it!&lt;/p>
&lt;h3 id="what-you-willneed">What you will need:
&lt;/h3>&lt;ul>
&lt;li>Azure Account&lt;/li>
&lt;li>Visual Studio Code&lt;/li>
&lt;li>VS Code — Azure Functions Plugin&lt;/li>
&lt;li>An Azure Virtual Machine&lt;/li>
&lt;/ul>
&lt;h3 id="preparing-the-virtualmachine">Preparing the Virtual Machine
&lt;/h3>&lt;p>Now we need to create a beacon in the VMs that we need to shutdown/startup. For this function, we’ll use a tag &lt;code>shutdownDaily&lt;/code> with the value &lt;code>true.&lt;/code> Later we will filter the VMs with this tag and shut it down in the function script.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_VMDq41L7qXNa_uWH.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="creating-the-shutdown-function">Creating the shutdown function.
&lt;/h3>&lt;p>Open the Visual Studio Code, and create a new Powershell Function:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_x3FsmyoMMUNj0q89.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Select the Timer Function option and give a name to the function:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_P6mXyablY5cs1Jfv.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Now we need to define how often the function will be executed. Here we will execute every day at 7 PM.&lt;/p>
&lt;p>The Azure Functions use cron expression to define the frequency. (&lt;a class="link" href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=csharp" target="_blank" rel="noopener"
>You can have more information here&lt;/a>)&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_n0gQs-THU0idujzR.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>It will create a basic function based on a template. We just need to keep the parameter &lt;code>$Timer.&lt;/code>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_oLUB3JIPcB0ma_tU.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>For ease, you can replace all code with the block below:&lt;/p>
&lt;h3 id="publishing-the-function-onazure">Publishing the function on Azure
&lt;/h3>&lt;p>Now let’s publish the function on Azure Account.&lt;/p>
&lt;p>First Sign in to Azure. It will redirect you to a Microsoft Login Screen in your browser. Enter your credentials and go back to Visual Studio Code.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_WmwVA4gnSHHC2RDf.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Click in the Upload Icon, and select the desired subscription to deploy:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_BYBgma7b7A8X1kAG.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Now create a new function, give a name, and select the region. It will create all resources with this name. If you need to change something, use the advanced mode. After creation it will deploy the code automatically:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_YgzrA2wK4fkZ1byd.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="given-permissions-to-thefunction">Given permissions to the function
&lt;/h3>&lt;p>After creating the function, we need to authorize it to manipulate Azure Resources. On function Settings, open Identity menu and change the status to On and save this.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_vvKuP65ge7TiWRdW.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>It will enable Azure role assignments button, touch this, and Add role assignment. Here I’ll create permission as a contributor int the subscription, but use the best approach to your environment:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_0nDFGluJUhFbx2pj.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_5TpXmm0HWeY8kJtp.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_agTsn3G0E0Ym6ChC.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="testing-thefunction">Testing the function
&lt;/h3>&lt;p>To test the function open it and run:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_TTBxoeKG68JZL3hk.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_vub82xMTqcUO97ji.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Expand the Logs menu, and check if everything is ok :)&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/save-money-with-azure-handling-your-resources-with-azure-functions/0_ZIaRcU6mg_3awEce.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="creating-a-startup-function">Creating a startup function.
&lt;/h3>&lt;p>For the startup function, create a new function and in the step to replace the auto-generated code, use the code below:&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Thi’s a simple use with one Virtual Machine, but you can expand this, with more complex environments as dependent resources and uses for other resources.&lt;/p>
&lt;p>I hope that it can be helpful to you!&lt;/p></description></item><item><title>Make your deployment faster parallelizing your jobs in Azure DevOps - Classic Editor</title><link>http://www.wesleycamargo.com/p/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/</link><pubDate>Fri, 05 Jun 2020 22:27:53 +0200</pubDate><guid>http://www.wesleycamargo.com/p/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_3cUlED971rCD_21ltjnMcQ.png" alt="Featured image of post Make your deployment faster parallelizing your jobs in Azure DevOps - Classic Editor" />&lt;h3 id="make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops---classiceditor">Make your deployment faster parallelizing your jobs in Azure DevOps - Classic Editor
&lt;/h3>&lt;p>One of the most regular works in clients or companies that I faced, is to improve your existing CI/CD pipelines, reducing errors or the time run. In this post, I’ll show how to configure your jobs using multi-configuration.&lt;/p>
&lt;h4 id="when-do-i-have-to-usethis">When do I have to use this?
&lt;/h4>&lt;p>I’ll use as a didactic example an application with two projects: an API and a Web Site. This maybe can be a simple example, but you can find a better use for this approach in your day-to-day activities, ideally with tasks that take a long time to execute, as creating resources like Virtual Machines, Web Apps, or any other operations. &lt;strong>The greater advantage is that if you have one job or ten, it will take just the time for one execution.&lt;/strong>&lt;/p>
&lt;p>Below you can see a representation of the process. Notice that we have two Web App deployments serialized. However maybe you can have many processes, and if you have to wait for all of them, it can have a long time-consuming.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_3cUlED971rCD_21ltjnMcQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Otherwise, create a parallel activity approach, as you can see in the next image, you can save a lot of time just doing a simple configuration.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_oGXCq1fM6O8MzJ5jPqUq8A.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="configuring-the-cdpipeline">Configuring the CD pipeline
&lt;/h4>&lt;p>I’ll use an existing build with two outputs: an API and a WebApp. The names used in the artifacts are important, we will use this later to define our application name. &lt;a class="link" href="https://medium.com/@camargo.wes/creating-a-net-core-application-and-pushing-to-github-or-azure-repos-22c115dde3a9" target="_blank" rel="noopener"
>Here&lt;/a>, I’ll show you how to create an application and send it to Azure DevOps.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_sTwA07LJk9zKklF2u59tXQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Create a classic CD pipeline for WebApp:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_u0NLg8-CMJhc2SRj7HGAUw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>After creation, open the variables tab and create a new var named &lt;strong>application&lt;/strong>.** **In the value enter the name of your artifacts split by a comma:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_88PWuEkqzUz6zjGM0NIM2Q.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Go back to the Tasks tab and open the agent options. In item 3, notice that it has the same variable that we created before. Item 4 it’s how many parallel jobs you would like to run.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1__FvRmjyzQnPX3iz5EdlPWg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>To use the multi-configuration, your WebApps names need some pattern. Here, I created a suffix and the end of the name will be the artifact name (or the split variable):&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_aDFsdhjmSy2kkwLAydJ0WA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Now let’s configure the WebApp options. This is easy, just configure according to your pattern using the variable name:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_sgqtmxbEd72BvLqnyvdKGw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Now, check if you have enough parallel jobs available in your account. The default’s it’s one parallel job for self-hosted and one Microsoft hosted agents, but if you have users with MSDN in their accounts, each one increases plus one parallel job. If you don’t have, you need to buy new parallel agents.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_AoqHHoWjq_HnTFCWD3MYag.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="running-and-testing">Running and testing :)
&lt;/h4>&lt;p>After running our pipeline, we can see it’s working running in two parallel agents:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_gg0HhZVjPrZkWtOHQVOokg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>After all, processes finished, we can see that’s done!&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/make-your-deployment-faster-parallelizing-your-jobs-in-azure-devops-classic-editor/1_-Ari24iWsvnvWoF2hC6iuw.png"
loading="lazy"
alt="Image"
>&lt;/p></description></item><item><title>Pushing your code to GitHub and Azure Repos at the same time</title><link>http://www.wesleycamargo.com/p/pushing-your-code-to-github-and-azure-repos-at-the-same-time/</link><pubDate>Fri, 22 May 2020 06:33:08 +0200</pubDate><guid>http://www.wesleycamargo.com/p/pushing-your-code-to-github-and-azure-repos-at-the-same-time/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/pushing-your-code-to-github-and-azure-repos-at-the-same-time/1_T1XtTzfeztcxintWQDAMyA.png" alt="Featured image of post Pushing your code to GitHub and Azure Repos at the same time" />&lt;h3 id="pushing-your-code-to-github-and-azure-repos-at-the-sametime">Pushing your code to GitHub and Azure Repos at the same time
&lt;/h3>&lt;p>If you have an existing repository hosted by an Azure Repos or in GitHub, you can add new remotes easily. Let’s see how we can do it!&lt;/p>
&lt;h4 id="creating-and-versioning-a-localproject">Creating and versioning a local project
&lt;/h4>&lt;p>Let’s create our project. In an empty directory type the CLI commands below:&lt;/p>
&lt;p>It will create a new .net core web application, with a gitignore file and versioned in a local git.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/pushing-your-code-to-github-and-azure-repos-at-the-same-time/1_T1XtTzfeztcxintWQDAMyA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="creating-an-azure-repos-repository-and-pushing-yourcode">Creating an Azure Repos repository and pushing your code
&lt;/h4>&lt;p>In your Azure DevOps account, follow these steps:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/pushing-your-code-to-github-and-azure-repos-at-the-same-time/1_2-w6QFXI1BKNjpfsFA4j6A.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>In the next screen disable the ‘Add a README’ option and enter your repo name:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/pushing-your-code-to-github-and-azure-repos-at-the-same-time/1_6Ac2s4pAuPtWqdJ83iZEFQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>In the empty repository created you have some options to push your code, we’ll push from an existing repository, so copy the command as the figure:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/pushing-your-code-to-github-and-azure-repos-at-the-same-time/1_-o92AzdgasXkufQXiH8yBA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>In your terminal paste the command, remember to check if you’re in your project directory. The highlighted log will confirm if your push was successful:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/pushing-your-code-to-github-and-azure-repos-at-the-same-time/1_uCQXpknv5LfF8haIA44_Vg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Refresh your Azure Repos page and your code was pushed!&lt;/p></description></item><item><title>Maratona Azure DevOps -Aprendendo na prática</title><link>http://www.wesleycamargo.com/p/maratona-azure-devops-aprendendo-na-pr%C3%A1tica/</link><pubDate>Thu, 21 May 2020 19:26:41 +0200</pubDate><guid>http://www.wesleycamargo.com/p/maratona-azure-devops-aprendendo-na-pr%C3%A1tica/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/maratona-azure-devops-aprendendo-na-prtica/1_hZ6lf-gqj9UPNDzGQwW-Dg.png" alt="Featured image of post Maratona Azure DevOps -Aprendendo na prática" />&lt;h3 id="maratona-azure-devops--aprendendo-naprática">Maratona Azure DevOps -Aprendendo na prática
&lt;/h3>&lt;p>Quer aprender como utilizar o Azure DevOps na prática? Então assista a Maratona Azure DevOps com mais de 12 horas de vídeos GRATUITOS.&lt;/p>
&lt;p>Ontem eu e a &lt;a class="link" href="https://medium.com/u/5f3c9bcfc939" target="_blank" rel="noopener"
>Jaqueline Ramos&lt;/a> finalizamos a segunda edição da Maratona Azure DevOps, foram 3 vídeos com aproximadamente 2 horas de conteúdo cada onde abordamos conceitos de DevOps e como aplicar na prática utilizando a ferramenta.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/maratona-azure-devops-aprendendo-na-prtica/1_hZ6lf-gqj9UPNDzGQwW-Dg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>A idéia da segunda edição foi de complementar o conteúdo da primeira, onde mostramos novidades como Pipelines YAML, importações de repositório e itens que não tivemos tempo de exibir na primeira.&lt;/p>
&lt;p>Abaixo estão os links para os vídeos da primeira e segunda edição, vou adicionar os vídeos da segunda edição na frente pois estão mais atualizados, espero que gostem!&lt;/p>
&lt;h3 id="segunda-edição">Segunda Edição
&lt;/h3>&lt;h4 id="primeiro-episódio">Primeiro episódio:
&lt;/h4>&lt;p>No primeiro dia da segunda edição da Maratona Azure DevOps tivemos uma abordagem mais conceitual falando sobre:&lt;/p>
&lt;ul>
&lt;li>Introdução a DevOps: Cultura e Práticas relacionadas&lt;/li>
&lt;li>Carreira em DevOps&lt;/li>
&lt;li>Ferramentas de colaboração&lt;/li>
&lt;/ul>
&lt;h4 id="segundo-episódio">Segundo episódio:
&lt;/h4>&lt;p>No segundo dia da segunda edição da maratona apresentamos alguns itens que não foram cobertos na primeira edição em:&lt;/p>
&lt;ul>
&lt;li>Azure Boards - Como gerenciar times, criar Dashboards, alterar templates de processos&lt;/li>
&lt;li>Azure Repos-Importando repositórios, utilizando Az CLI para alterações nos repositórios, criando um repositório local e enviando para o Azure DevOps, boas práticas para criação de repositórios&lt;/li>
&lt;li>Azure Pipelines - Criando Pipelines YAML&lt;/li>
&lt;li>Azure Artifacts - Criando um feed e enviando pacotes NuGet para o Azure Artifacts&lt;/li>
&lt;/ul>
&lt;h4 id="terceiro-episódio">Terceiro episódio:
&lt;/h4>&lt;p>No terceiro dia da maratona apresentamos:&lt;/p>
&lt;ul>
&lt;li>Azure Test Plans - Conheça como você pode gerenciar seus testes com o Azure Devops através de Work Items e automações de teste&lt;/li>
&lt;li>Azure DevOps e Integrações -Já utiliza Jenkins, SonarCloud, AWS ou outras ferramentas em seus projetos? Saiba como integra-las ao Azure DevOps e obter o melhor para sua empresa&lt;/li>
&lt;li>Preços - Entenda como são feitas as cobranças do Azure DevOps, e COMO UTILIZAR OS RECURSOS GRATUÍTOS!&lt;/li>
&lt;/ul>
&lt;h3 id="primeira-edição">Primeira Edição
&lt;/h3>&lt;h4 id="primeiro-episódio-1">Primeiro episódio:
&lt;/h4>&lt;p>Azure DevOps: Introdução (Como começar, administração, custos, etc) Azure Boards: Trabalhando com WorkItens e Processo de desenvolvimento&lt;/p>
&lt;h4 id="segundo-episódio-1">Segundo episódio:
&lt;/h4>&lt;p>Utilizando Azure Repos: Controle de versão&lt;/p>
&lt;h4 id="terceiro-episódio-1">Terceiro episódio:
&lt;/h4>&lt;p>Azure Pipelines: Criando seu primeiro pipeline de entrega&lt;/p>
&lt;h4 id="quarto-episódio">Quarto episódio:
&lt;/h4>&lt;p>Azure Test Plans: Testes integrados ao seu pipeline 
Azure Boards: Dashboards&lt;/p></description></item><item><title>How to send .Net Core NuGet packages to Azure Artifacts</title><link>http://www.wesleycamargo.com/p/how-to-send-.net-core-nuget-packages-to-azure-artifacts/</link><pubDate>Sat, 09 May 2020 04:49:34 +0200</pubDate><guid>http://www.wesleycamargo.com/p/how-to-send-.net-core-nuget-packages-to-azure-artifacts/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/how-to-sendanet-core-nuget-packages-to-azure-artifacts/0_oywzs4eXdLxxWk5u.png" alt="Featured image of post How to send .Net Core NuGet packages to Azure Artifacts" />&lt;h3 id="how-to-sendnet-core-nuget-packages-to-azure-artifacts">How to send .Net Core NuGet packages to Azure Artifacts
&lt;/h3>&lt;p>Learn how you can send .net core NuGet packages to Azure Artifacts.&lt;/p>
&lt;p>To increase reusability in our company, an interesting thing that we can consider is to share our packages. Using .net, both core or standard, you can consider NuGet as a package manager. The Azure DevOps has an implementation for a &lt;strong>NuGet as a Service&lt;/strong> named &lt;strong>Azure Artifacts&lt;/strong>.&lt;/p>
&lt;p>In this post, I’ll show you how to deploy manually a NuGet package step by step.&lt;/p>
&lt;p>Below are all commands used in this tutorial, but I’ll explain each one.&lt;/p>
&lt;p>Let’s get the hands dirty!&lt;/p>
&lt;h4 id="creating-and-configuring-an-application">Creating and configuring an application
&lt;/h4>&lt;p>To start, we need a .net core class library application. To do this, type on terminal:&lt;/p>
&lt;p>dotnet new classlibIt will create a basic project with a .csproj and one class. Rename the class to Math and put the code below on this:&lt;/p>
&lt;p>To send new packages, first, we need to configure a connection between our app and the feed that will be created. For now, we’ll add a nuget.config file in our project. On terminal type:&lt;/p>
&lt;p>dotnet new nugetconfigA file like this will be created:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-sendanet-core-nuget-packages-to-azure-artifacts/0_oywzs4eXdLxxWk5u.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>This is the standard NuGet feed, after create ours we will update this file.&lt;/p>
&lt;p>Now let’s package the project in a NuGet package using this command:&lt;/p>
&lt;p>dotnet packIt will create a nupkg file in the bin directory. We’ll use this later.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-sendanet-core-nuget-packages-to-azure-artifacts/0_83XEvUyH0uDKcUWR.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>The project it’s done, now let’s create the feed.&lt;/p>
&lt;h4 id="creating-a-new-artifact-feed-with-azure-artifacts">Creating a new artifact feed with Azure Artifacts
&lt;/h4>&lt;p>Access your Azure DevOps account and follow the steps:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-sendanet-core-nuget-packages-to-azure-artifacts/0_EXzq8-qaE0Ac_ts2.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-sendanet-core-nuget-packages-to-azure-artifacts/0_vkeAqTVvYmVduEBd.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>On the next screen click on Connect to feed:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-sendanet-core-nuget-packages-to-azure-artifacts/0_9izcpWYFJoem9d1H.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-sendanet-core-nuget-packages-to-azure-artifacts/0_v8PKHzfxVPp0xt3g.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Here is the connection information necessary to connect our app with the feed. Copy the Project setup content and update the value of the nuget.config created before.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-sendanet-core-nuget-packages-to-azure-artifacts/0_egn74caQQW8ObuXS.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="connecting-tofeed">Connecting to feed
&lt;/h4>&lt;p>To make the connection, we need to download and install a connection provider. Save the content below in a file and run:&lt;/p>
&lt;p>After installing the credential provider, we can authenticate with Azure DevOps. In the previous section in Publish packages, it’s given to you command with your connection information, add the parameter &lt;strong>interactive&lt;/strong>. It will be used to start a new browser session and do the authentication. Without this parameter, the command won’t work.&lt;/p>
&lt;p>dotnet nuget push .\bin\Debug\NugetPackage.1.0.0.nupkg &amp;ndash;source &amp;ldquo;MeuFeed&amp;rdquo; &amp;ndash;api-key teste &amp;ndash;interactiveIt will be provided a URL and code, open the URL in the browser, and paste the code there.&lt;/p></description></item><item><title>Enviando pacotes Nuget .Net Core para o Azure Artifacts</title><link>http://www.wesleycamargo.com/p/enviando-pacotes-nuget-.net-core-para-o-azure-artifacts/</link><pubDate>Fri, 08 May 2020 00:40:29 +0200</pubDate><guid>http://www.wesleycamargo.com/p/enviando-pacotes-nuget-.net-core-para-o-azure-artifacts/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/enviando-pacotes-nugetanet-core-para-o-azure-artifacts/1_IBa82AI5wwkn7GyNuVf4lw.png" alt="Featured image of post Enviando pacotes Nuget .Net Core para o Azure Artifacts" />&lt;h3 id="enviando-pacotes-nugetnet-core-para-o-azure-artifacts">Enviando pacotes Nuget .Net Core para o Azure Artifacts
&lt;/h3>&lt;p>Aprenda como publicar packages nuget no Azure Artifacts!&lt;/p>
&lt;p>Para podermos ter maior reusabilidade dentro de nossa empresa, é interessante a utilização de pacotes compartilhados. No caso do .net, tanto core como standart utilizam o Nuget como Gerenciador de pacotes.&lt;/p>
&lt;p>Nesse post irei ensinar passo a passo para realizar a publicação manual de um pacote nuget.&lt;/p>
&lt;p>Ao longo do post irei detalhar cada um deles, mas abaixo estão todos os comandos executados no terminal:&lt;/p>
&lt;p>Agora vamos botar a mão na massa!&lt;/p>
&lt;h4 id="criando-e-configurando-a-aplicação">Criando e configurando a aplicação
&lt;/h4>&lt;p>Vamos iniciar criando uma aplicação do tipo class library no .net core. Para isso digite no terminal (se você não tem familiaridade com o .net core &lt;a class="link" href="https://medium.com/@camargo.wes/criando-um-pipeline-de-ci-cd-usando-github-actions-645a5199f650" target="_blank" rel="noopener"
>nesse post&lt;/a> ensino como criar uma aplicação web no VS Code):&lt;/p>
&lt;p>dotnet new classlibO projeto criado é bem básico, possuindo apenas um .csproj e uma classe. Renomeie a classe para Math e adicione o código abaixo:&lt;/p>
&lt;p>Vamos empacotar o projeto em um nuget package executando o comando:&lt;/p>
&lt;p>dotnet packSerá criado um arquivo nupkg na pasta bin. Usaremos ele mais tarde.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/enviando-pacotes-nugetanet-core-para-o-azure-artifacts/1_IBa82AI5wwkn7GyNuVf4lw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Para enviar novos pacotes precisamos realizar a conexão da nossa aplicação com o feed que vamos criar. Vamos então adicionar um arquivo nuget.config em nosso projeto. No terminal digite:&lt;/p>
&lt;p>dotnet new nugetconfigSerá criado um arquivo em nosso projeto como este:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/enviando-pacotes-nugetanet-core-para-o-azure-artifacts/1_WmvMZY1rk6UHFa3sTIp-dQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>O feed configurado é o padrão, para adicionar as configurações do nosso feed, vamos criá-lo e obter as conexões.&lt;/p>
&lt;h4 id="criando-o-feed-de-artefatos-no-azure-artifacts">Criando o feed de artefatos no Azure Artifacts
&lt;/h4>&lt;p>Acesse sua conta do Azure DevOps e siga os passos abaixo:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/enviando-pacotes-nugetanet-core-para-o-azure-artifacts/1_pqzB4BtIR_fJZXV3Guv6BA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/enviando-pacotes-nugetanet-core-para-o-azure-artifacts/1_FDgHA8bxqbOuQvbLXAIOOg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Na tela que irá aparecer clique em Connect to feed:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/enviando-pacotes-nugetanet-core-para-o-azure-artifacts/1_59mH-OrThLhu6a8MZe3SDQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/enviando-pacotes-nugetanet-core-para-o-azure-artifacts/1_srWBBdJZy5XlebE27MuQyA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Aqui estão as informações de conexão que iremos utilizar. Copie o conteúdo de Project setup e substitua o valor do arquivo nuget.config que criamos.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/enviando-pacotes-nugetanet-core-para-o-azure-artifacts/1_dQIXu0zg95Qtpn2EfuEMyA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="conectando-aofeed">Conectando ao feed
&lt;/h4>&lt;p>Para realizar a conexão, precisamos baixar um provider. Para isso abre uma nova janela no VS Code e copie o conteúdo do arquivo abaixo salvando como CredentialProvider.ps1 e execute:&lt;/p>
&lt;p>Agora que foi instalado o Credential Provider vamos conseguir autenticar no Azure DevOps. Na seção anterior em Publish packages é disponibilizado um comando copie ele e não se esqueça de adicionar o parâmetro &lt;strong>interactive&lt;/strong>. Ele serve para iniciar uma sessão no browser e realizar a autenticação. Sem ele o comando não irá funcionar.&lt;/p>
&lt;p>dotnet nuget push .\bin\Debug\NugetPackage.1.0.0.nupkg &amp;ndash;source &amp;ldquo;MeuFeed&amp;rdquo; &amp;ndash;api-key teste &amp;ndash;interactiveCopie e abra no browser a URL que será fornecida e copie o código:&lt;/p></description></item><item><title>Como criar uma conta no Azure DevOps</title><link>http://www.wesleycamargo.com/p/como-criar-uma-conta-no-azure-devops/</link><pubDate>Mon, 27 Jan 2020 14:00:32 +0100</pubDate><guid>http://www.wesleycamargo.com/p/como-criar-uma-conta-no-azure-devops/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/como-criar-uma-conta-no-azure-devops/1_zEidCQ--naWxnUjYattZ3A.png" alt="Featured image of post Como criar uma conta no Azure DevOps" />&lt;h3 id="como-criar-uma-conta-no-azuredevops">Como criar uma conta no Azure DevOps
&lt;/h3>&lt;p>Olá pessoal, irei ensinar a vocês como criar uma conta gratuita no Azure DevOps, vamos ao passo a passo:&lt;/p>
&lt;p>Acesse o site &lt;a class="link" href="https://dev.azure.com" target="_blank" rel="noopener"
>https://dev.azure.com&lt;/a> e clique no botão Start free:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-criar-uma-conta-no-azure-devops/1_zEidCQ--naWxnUjYattZ3A.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Existem 3 opções principais:&lt;/p>
&lt;ul>
&lt;li>Acessar como uma conta Microsoft existente (email @outlook, @hotmail, etc)&lt;/li>
&lt;li>Criar uma nova conta&lt;/li>
&lt;li>Acessar com uma conta do GitHub&lt;/li>
&lt;/ul>
&lt;p>Vamos criar uma nova conta, mas caso você já possua uma conta no Github também poderá utilizar.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-criar-uma-conta-no-azure-devops/1_oyShPMvn8Y7WQ5ZYMDF6Nw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Se você possuir uma conta Microsoft (outlook, hotmail, msn) poderá inserir aqui, caso não possua clique na opção para criar uma nova conta de email:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-criar-uma-conta-no-azure-devops/1_6hWFOG0kO-yr2ndXQUDsfA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Insira um novo email que esteja disponível:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-criar-uma-conta-no-azure-devops/1_7b1Irktv99Nl7prnysZoFQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Insira sua senha:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-criar-uma-conta-no-azure-devops/1_UN6-SVfRJaLM2jNVyRqH0w.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Em região escolha Brazil:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-criar-uma-conta-no-azure-devops/1_N_iO-6UDYRVqYCWCyo4g3w.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Nesse momento sua conta será criada, aguarde alguns instantes enquanto esse processo é realizado:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-criar-uma-conta-no-azure-devops/1_sjQ3hXrGfbHnlrcdCWEZGQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Sua conta já está criada!&lt;/p>
&lt;p>Agora precisamos criar um Team Project. Ele pode ser o nome da sua equipe, seu produto, ou o que fizer mais sentido para o seu projeto. Aqui podemos nomea-lo como “Projetos”&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-criar-uma-conta-no-azure-devops/1_hov9Q2jrWyu04XlPuMyhJw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Agora seu Azure DevOps está pronto para ser utilizado!&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-criar-uma-conta-no-azure-devops/1_SkeetDjdL7XA_JAbfSf90w.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Esse é o setup básico, como disse acima existem outras opções, mas ao final todas irão criar sua organização no Azure DevOps!&lt;/p></description></item><item><title>Gerenciando transformações de configuração com Azure Key Vault e VSTS</title><link>http://www.wesleycamargo.com/p/gerenciando-transforma%C3%A7%C3%B5es-de-configura%C3%A7%C3%A3o-com-azure-key-vault-e-vsts/</link><pubDate>Thu, 15 Feb 2018 16:21:22 +0100</pubDate><guid>http://www.wesleycamargo.com/p/gerenciando-transforma%C3%A7%C3%B5es-de-configura%C3%A7%C3%A3o-com-azure-key-vault-e-vsts/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/0_LZ9C3pXOV3xuvyWq.png" alt="Featured image of post Gerenciando transformações de configuração com Azure Key Vault e VSTS" />&lt;h3 id="gerenciando-transformações-de-configuração-com-azure-key-vault-evsts">Gerenciando transformações de configuração com Azure Key Vault e VSTS
&lt;/h3>&lt;p>Quem nunca teve dificuldade para fazer a gestão de arquivos de configuração que atire a primeira pedra!&lt;/p>
&lt;p>Com a automação dos processos de build e deploy, uma etapa muito importante do processo é alteração das chaves dos arquivos de configuração, pois em cada um de nossos ambientes, teremos também valores diferentes, como por exemplo a connection string de um banco de dados.&lt;/p>
&lt;p>Irei abordar uma maneira inteligente de realizar isso, através da transformação no momento do deploy utilizando o Azure Key Vault no momento de realização da Release no Visual Studio Team Services, então mãos a obra!&lt;/p>
&lt;p>Para demonstrar, irei utilizar uma aplicação web simples, que será compilada no VSTS e publicada em um Azure Web App (em outro post irei explicar como criar e configurar um :)).&lt;/p>
&lt;p>&lt;strong>O que é o Azure Key Vault?&lt;/strong>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/0_LZ9C3pXOV3xuvyWq.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>O Azure Key Vault é um recurso do Azure onde são armazenadas chaves e segredos para realizar a comunicação entre aplicações. Com ele podemos armazenar dados sensíveis(Segredos), Certificados .PFX, Key encription Keys (KEK) e também é possível utilizar sua API para realizar criptografia. Para mais informações à respeito, segue o link da documentação &lt;a class="link" href="https://azure.microsoft.com/en-us/services/key-vault/" target="_blank" rel="noopener"
>https://azure.microsoft.com/en-us/services/key-vault/&lt;/a>&lt;/p>
&lt;p>&lt;strong>Entre as vantagens de utilização destacam-se:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>Gestão de forma centralizada&lt;/li>
&lt;li>Maior segurança na administração dos dados sensíveis&lt;/li>
&lt;li>Maior facilidade na administração, pois pode ser feita no Azure Portal&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Como implementar?&lt;/strong>&lt;/p>
&lt;p>O primeiro passo é criar um Azure Key Vault no Azure Portal:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/1_nx7lCO0MwgnJ13_U7ci9Aw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Selecione Add e na sequência preencha nome, Resource Group e Location. O restante das informações podem ser mantidas. Clique em Create:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/1_Db5ICSpI3_IdNssDLi69Lg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Após a criação, selecione “Secrets” e “Generate/Import”:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/1_ON1rL_yJBKq3Z5_Yk3hdlg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Na próxima etapa iremos realizar a criação da chave/secret. Em Upload Options selecione Manual, e adicione o nome da variável e o valor. Note que por ser um secret aparecem asteriscos quando o valor é digitado:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/1_yAMfpsvEpZ_8yiCJB8bjJA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Agora que temos nossa chave criada, vamos ao VSTS realizar a configuração de um Release Definition utilizando o Key Vault.&lt;/p>
&lt;p>Para isso iremos utilizar um Variable Group e nele iremos realizar o link com o Key Vault.&lt;/p>
&lt;p>Selecione a opção de Build/Release e em seguida Library. Após isso crie um novo Variable Group:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/1_1dzMMvFwmQE-hoCNKwat0w.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Agora devemos nomear o Variable Group e selecionar Link Secrets from an Azure Key Vault. Então selecione uma subscription e o Key Vault criado anteriormente. 
Após selecionar o Key Vault, será solicitada uma autorização para utilização, pode ser necessária uma permissão mais elevada no VSTS para relizar este passo:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/1_CR9CpspeIxahIV_rCKhmGA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Selecione as variáveis desejadas no grid que será habilitado e salve o Variable Group:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/1_ZKGYMXc8SRQX8e_UpfYoKA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/1_QdieHNnS42PLsLQlw55Xvg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Para utilizar na Release Definition, vá em Variables e selecione Variable Groups. Clique em Link variable group:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/1_PCvfwJhmXK4uqO0R_YmFgw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Agora selecione o Variable Group criado, e clique em Link.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/gerenciando-transformaes-de-configuraao-com-azure-key-vault-e-vsts/1_Eh0EakNsTdVBmYLV3-r29g.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Pronto, agora as variáveis do Azure Key Vault podem ser utilizadas no processo de Release. Para utilizar, é o mesmo processo de utilização de uma variável criada durante a release, utilizando $(nomedavariavel) em algum script ou parâmetro.&lt;/p>
&lt;p>Espero que este artigo seja útil, ajudando no processo de transformações de arquivos tornando mais prático e seguro!&lt;/p>
&lt;p>Abraço!&lt;/p></description></item></channel></rss>