<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Development on Wesley Camargo</title><link>http://www.wesleycamargo.com/categories/development/</link><description>Recent content in Development on Wesley Camargo</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Wed, 06 Dec 2023 19:01:04 +0100</lastBuildDate><atom:link href="http://www.wesleycamargo.com/categories/development/index.xml" rel="self" type="application/rss+xml"/><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>This is what you should do to make your CI/CD more secure</title><link>http://www.wesleycamargo.com/p/this-is-what-you-should-do-to-make-your-ci/cd-more-secure/</link><pubDate>Wed, 14 Jun 2023 18:04:59 +0200</pubDate><guid>http://www.wesleycamargo.com/p/this-is-what-you-should-do-to-make-your-ci/cd-more-secure/</guid><description>&lt;img src="https://cdn-images-1.medium.com/max/800/0*HQSrqlfb4u0sFQe6" alt="Featured image of post This is what you should do to make your CI/CD more secure" />&lt;h3 id="this-is-what-you-should-do-to-make-your-cicd-moresecure">This is what you should do to make your CI/CD more secure
&lt;/h3>&lt;p>Security is now a trending topic in the IT industry, with data leaks and breaches happening left and right, so it’s super important to tackle any risks in our environments. One of these risks is the management of Service Principal secrets to connect to workloads running outside Azure, such as other clouds or external CI/CD tools. In this post, we will learn how to use Workload Identity Federation to tackle this and make our DevOps process more secure and efficient.&lt;/p>
&lt;h3 id="making-your-cicd-more-secure-with-passwordless-authentication-onazure">Making your CI/CD more secure with Passwordless Authentication on Azure
&lt;/h3>&lt;p>&lt;img src="https://cdn-images-1.medium.com/max/800/0*HQSrqlfb4u0sFQe6"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@moneyphotos?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>regularguy.eth&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="pre-requisites">Pre-requisites
&lt;/h3>&lt;ul>
&lt;li>Azure Service Principal Name or Azure Managed Identity&lt;/li>
&lt;li>GitLab repository&lt;/li>
&lt;/ul>
&lt;h3 id="what-is-workload-identity-federation">What is Workload Identity Federation?
&lt;/h3>&lt;p>WIF (Windows Identity Foundation) enables passwordless authentication, granting access to Azure AD and Azure Resources without the need to manage secrets or certificates.&lt;/p>
&lt;p>Once configured, you establish trust with an external OpenID Connect (OIDC) identity provider such as GitHub, GitLab, Kubernetes, Google, and AWS, also known as **Issuer. **It is also necessary to provide the &lt;strong>Subject Identifier&lt;/strong>, so Azure AD will be able to identify the resource when attempting to log in and establish a connection with the external application.&lt;/p>
&lt;h3 id="how-to-setup-workload-identity-federation-onazure">How to setup Workload Identity Federation on Azure
&lt;/h3>&lt;p>The process to set up is quite simple but requires permissions to manipulate Azure AD identities. It consists of appending an existing AAD, which can be a Service Principal or a Managed Identity with a Federated Credential.&lt;/p>
&lt;p>In our example, I will configure it in a GitLab pipeline.&lt;/p>
&lt;p>To do so, it is necessary to inform&lt;/p>
&lt;ul>
&lt;li>Issuer: The Identity Provider, in our case &lt;code>[https://gitlab.com](https://gitlab.com)&lt;/code>&lt;/li>
&lt;li>Subject Identifier: In the case of a GitLab pipeline, the repository name &lt;code>project_path:&amp;lt;project&amp;gt;/&amp;lt;repo name&amp;gt;:ref_type:branch:ref:main&lt;/code>&lt;/li>
&lt;li>Audience: Service account tokens &lt;code>[https://gitlab.com](https://gitlab.com)&lt;/code>&lt;/li>
&lt;/ul>
&lt;h4 id="creating-an-azure-user-managedidentity">Creating an Azure User Managed Identity
&lt;/h4>&lt;p>If you don’t have a Service Principal or Managed Identity in place yet, you can run the Azure CLI script below. It creates the MI and sets Contributor permission in the current subscription.&lt;/p>
&lt;p>The script will also print out the TenantId a ClientID that will be necessary to connect on the GitLab pipeline.&lt;/p>
&lt;h4 id="setting-up-an-azure-federated-credential">Setting up an Azure Federated Credential
&lt;/h4>&lt;p>The script below creates the Federated Credential in an existing Manage Identity. It can also be replaced by a Service Principal.&lt;/p>
&lt;h3 id="configuring-gitlab-cicdsettings">Configuring GitLab CI/CD Settings
&lt;/h3>&lt;p>On the GitLab side, you just need to inform the TenantId and ClientId that were prompted in the creation of the Managed Identity.&lt;/p>
&lt;p>The pipeline below demonstrates how to connect and create a resource group in an Azure Subscription:&lt;/p>
&lt;p>After running the pipeline, you can see that the connection was successful:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/this-is-what-you-should-do-to-make-your-cicd-more-secure/1_iwJ-Vzmm0Nti_Ju2R_rykw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/this-is-what-you-should-do-to-make-your-cicd-more-secure/0_NDaQ7lVOrIQVhEGs.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>Git Basic commands in a nutshell</title><link>http://www.wesleycamargo.com/p/git-basic-commands-in-a-nutshell/</link><pubDate>Thu, 27 Oct 2022 14:55:13 +0200</pubDate><guid>http://www.wesleycamargo.com/p/git-basic-commands-in-a-nutshell/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/0_Fuhc6LIKQ3NiJEDU.png" alt="Featured image of post Git Basic commands in a nutshell" />&lt;h3 id="git-basic-commands-in-anutshell">Git Basic commands in a nutshell
&lt;/h3>&lt;p>Without a doubt, git is the most popular Version Control System nowadays. There is a big chance that everyone who works with IT already heard about it, or even already used git. In this post, I gathered the most common git commands in one place and a brief explanation about them.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/0_Fuhc6LIKQ3NiJEDU.png"
loading="lazy"
alt="Image"
>
Commit workflow — Image from &lt;a class="link" href="https://git-scm.com/about/staging-area" target="_blank" rel="noopener"
>Git Docs&lt;/a>&lt;/p>
&lt;p>At the end of the post, I will let all commands used with the description of them.&lt;/p>
&lt;h3 id="prerequisites">Prerequisites
&lt;/h3>&lt;p>To demonstrate in a more realistic scenario, in this post we will use a dotnet core project and, of course, the git tool. Right below, you can see all the prerequisites to follow it, and after there are links for previous posts showing how to configure git and VS Code, as well as how to install dotnet core and create a project with it.&lt;/p>
&lt;ul>
&lt;li>git&lt;/li>
&lt;li>Visual Studio Code&lt;/li>
&lt;li>dotnet core&lt;/li>
&lt;li>Windows Terminal&lt;/li>
&lt;/ul>
&lt;h4 id="git-and-visual-studiocode">Git and Visual Studio Code
&lt;/h4>&lt;p>Git and Visual Studio Code are the main tools that we will be using in this post, so if you do not have it already configured, in &lt;a class="link" href="https://camargo-wes.medium.com/how-to-setup-your-environment-with-git-and-vs-code-with-choco-23d90f598d24" target="_blank" rel="noopener"
>this post&lt;/a>, I describe how to set it up.&lt;/p>
&lt;h4 id="creating-a-dotnet-coreproject">Creating a dotnet core project
&lt;/h4>&lt;p>To demonstrate in a more realistic scenario, we will create a simple dotnet core project. In this &lt;a class="link" href="https://camargo-wes.medium.com/how-to-create-a-dotnet-core-project-with-command-line-11f7cc142e2e" target="_blank" rel="noopener"
>post&lt;/a>, I show how to configure dotnet core on your computer, and also how to create a web app project to be used as an example.&lt;/p>
&lt;h3 id="how-to-configure-gitlocally">How to configure git locally
&lt;/h3>&lt;h4 id="initializing-a-git-repository">Initializing a git repository
&lt;/h4>&lt;p>Initializing the git repository is the first step to start working with git. It will create the git structure, and allow you to start versioning your files. It is possible to initialize either an empty directory or a directory with files inside already. In our case, we already created the project files previously following this &lt;a class="link" href="https://camargo-wes.medium.com/how-to-create-a-dotnet-core-project-with-command-line-11f7cc142e2e" target="_blank" rel="noopener"
>post&lt;/a>.&lt;/p>
&lt;p>It is possible to initialize the git repository by either the user interface or the command line, which one is better, depending on your personal preferences. Below you can see both options:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/1_a9Ym0PL-XMeIMNAnBT4aHA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>For the command line, simply type the command &lt;code>git init&lt;/code> . And that’s it! Quite simple as I promised :).&lt;/p>
&lt;h4 id="what-is-thegit-directory">What is the .git directory?
&lt;/h4>&lt;p>.git directory is a hidden directory that git creates to keep its files inside. You rarely need to change something in these files, but it’s worth knowing that git uses &lt;code>.git&lt;/code> a directory to identify and control your repository. Due to the fact this is hidden, you need to run a special command to see it. With PowerShell, you can see with the command &lt;code>Get-ChildItem -Hidden&lt;/code>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/1_c9xJW-cSEhtYjljWwKCFAA.png"
loading="lazy"
alt="Image"
>
.git directory — Image prepared by Author&lt;/p>
&lt;p>To verify how the files are being tracked by git, click on the git icon on the left menu. After that, it is possible to see all files under “Changes”&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/1_kOv7KudC4OCvilsM8AoVdA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="what-are-the-basic-git-commands-for-local-repositories">What are the basic git commands for local repositories
&lt;/h3>&lt;h4 id="ignoring-files">ignoring files
&lt;/h4>&lt;p>Before we go to the commands themselves, it is important to understand that in some cases, it is not desirable to keep certain files under source control. For example, when we work with compiled languages, it generates binary files that you don’t want to keep under version control, as they can always be generated using the code that is already versioned.&lt;/p>
&lt;p>To solve this problem you need to create a .gitignore file, with instructions on which files you don’t want to keep versioned.&lt;/p>
&lt;p>To create this file, as we are using a dotnet core application as an example, in the VS Code terminal, ensure that you are in the root directory of your repository and type &lt;code>dotnet new gitignore&lt;/code>.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/1_rgiVE7dvpIlT5CrLezoBpw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>You can see that among others, the folders &lt;code>bin&lt;/code>and &lt;code>obj&lt;/code> are listed, which is what we want in our case.&lt;/p>
&lt;h4 id="stageadding-files-to-stage-withgit">stage — Adding files to stage with git
&lt;/h4>&lt;p>Staging is an intermediate area where you keep your changed files before you finish the commit. It allows you to review and format them, and also makes it easy to commit your files partially.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/0_Fuhc6LIKQ3NiJEDU.png"
loading="lazy"
alt="Image"
>
Commit workflow — Image from &lt;a class="link" href="https://git-scm.com/about/staging-area" target="_blank" rel="noopener"
>Git Docs&lt;/a>&lt;/p>
&lt;p>The command &lt;code>git add&lt;/code> is used to add the files to the staging area. You can add file by file specifying the name &lt;code>git add &amp;lt;your file name&amp;gt;&lt;/code>, or you can add all files at once with &lt;code>git add .&lt;/code>&lt;/p>
&lt;p>In our project, let’s first add the gitignore that we created in the session above. It will prevent adding any undesired files that are already generated.&lt;/p>
&lt;p>For this type the command &lt;code>git add .\.gitignore&lt;/code>. You will notice that on VS Code the letter in front of the file name changed from U(Untracked) to A(index Added) and also it slightly changed the color. It means that this file is under the staging area.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/1_ExLkWcOnrGycDacgiftVyg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Now that the gitignore is already there, we can add the remaining files with &lt;code>git add .&lt;/code> .&lt;/p>
&lt;h4 id="recording-your-changes-with-gitcommit">Recording your changes with git commit
&lt;/h4>&lt;p>Finally, we will be able to create our first commit! It will record our changes in the version control. It always requires a comment, to identify what had changed in this commit. To do so, use the command &lt;code>git commit -m &amp;quot;my first commit&amp;quot;&lt;/code> . Notice that all files under the source control menu disappeared, but no worries, it means that there are no more files in the staging area, and they are already “safe”.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/1_WWe1X1lVtUuQmyIzE47fWw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="finding-the-status-of-your-changedfiles">Finding the status of your changed files
&lt;/h4>&lt;p>Before, we checked the files in the staging area by the user interface. But it’s also possible to use the command &lt;code>git status&lt;/code> for that. Notice that is possible to visualize either the Staged and Untracked files:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/1_J3B6lmtSlSvvBFwOxAputw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="using-git-log-to-show-yourhistory">Using git log to show your history
&lt;/h4>&lt;p>The command&lt;code>git log&lt;/code> is used to show the commits history, and brings useful information. By default, it shows the commit hash, which helps to track in which branches, or environments the changes are, the author and date of commits, which helps to identify who made those changes, and finally the comment of the commits that shows (if used correctly🙃) the purpose of that commit.&lt;/p>
&lt;p>You can also customize the results, one of my favorites is to show all commits in one line, for this you can use &lt;code>git log — pretty=oneline&lt;/code>.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/1_bRS7QOz3KK4cBgHWbRUEiw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>If you followed the &lt;a class="link" href="https://camargo-wes.medium.com/how-to-setup-your-environment-with-git-and-vs-code-with-choco-23d90f598d24" target="_blank" rel="noopener"
>first post&lt;/a> of the version control series to set up your git environment, I also included the configuration of an alias for a log command with some formats I like to use. You can also see all details of this in &lt;a class="link" href="https://camargo-wes.medium.com/creating-a-pretty-git-log-61f312f45201" target="_blank" rel="noopener"
>this post&lt;/a>.&lt;/p>
&lt;h4 id="creating-and-moving-among-gitbranches">Creating and moving among git branches
&lt;/h4>&lt;p>There are several ways to work with git and organize your branches, which is called &lt;strong>branch strategy&lt;/strong>. In the most common it is necessary to create branches to apart your code from the stable branch.&lt;/p>
&lt;p>In the DevOps community, there are polemic discussions that branching is a bad practice that avoids real continuous integration, but this is not the topic that we are approaching today.&lt;/p>
&lt;p>Independent if it is a good practice or not, branches are very useful for many situations and it’s worth having it in your toolbox.&lt;/p>
&lt;p>When a repository is created, it always creates a default branch, which can be called &lt;code>master&lt;/code> or &lt;code>main&lt;/code> depending on your preferences, and both can be used as stable branches or baselines.&lt;/p>
&lt;p>It is fairly common to create branches called &lt;code>**features**&lt;/code>, so it is possible to work without interfering with the stable branch.&lt;/p>
&lt;p>To list the branches on your repository, simply type &lt;code>git branch&lt;/code>, and it will show all local branches that you have. If you have a remote repository you can also list the remote branches with the command &lt;code>git branch -r&lt;/code>.&lt;/p>
&lt;p>To create a new branch use the command &lt;code>git branch &amp;lt;branch name&amp;gt;&lt;/code> or &lt;code>git checkout -b &amp;lt;branch name&amp;gt;&lt;/code> . Personally, I prefer the second option, as it already switches to the newlywed-created branch.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/1_-kVWZXyyymzr93tN1j3CtA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Imagine that after some commits on your feature branch for some reason you want to move back to master, so the &lt;code>git checkout &amp;lt;branch name&amp;gt;&lt;/code>command will be moving from one branch to another.&lt;/p>
&lt;h3 id="all-basic-git-commandsgathered">All basic git commands gathered
&lt;/h3>&lt;p>As promised, below are all commands used in this post:&lt;/p>
&lt;h3 id="key-takeaways">Key take aways
&lt;/h3>&lt;p>Git is a foundation of mostly modern development, and starting with it is quite simple. I hope that with this commands list you will help you move forward with the IT world!&lt;/p>
&lt;h4 id="related-posts">Related posts
&lt;/h4>&lt;p>&lt;a class="link" href="https://camargo-wes.medium.com/how-to-create-a-dotnet-core-project-with-command-line-11f7cc142e2e" target="_blank" rel="noopener"
>How to create a dotnet core project with command line | by Wesley Camargo | Oct, 2022 | Medium&lt;/a>&lt;/p>
&lt;p>&lt;a class="link" href="https://camargo-wes.medium.com/how-to-setup-your-environment-with-git-and-vs-code-with-choco-23d90f598d24" target="_blank" rel="noopener"
>How to setup your environment with git and VS Code with choco | by Wesley Camargo | Oct, 2022&lt;/a>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/git-basic-commands-in-a-nutshell/0_Ibsvh13DKfhQqsj3.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇&lt;/p>
&lt;h3 id="join-faun--get-similar-stories-in-your-inbox-eachweekhttpfromfauntor8zxxd">🚀&lt;a class="link" href="http://from.faun.to/r/8zxxd" target="_blank" rel="noopener"
>Join FAUN &amp;amp; get similar stories in your inbox each week&lt;/a>
&lt;/h3></description></item><item><title>How to create a dotnet core project with command line</title><link>http://www.wesleycamargo.com/p/how-to-create-a-dotnet-core-project-with-command-line/</link><pubDate>Wed, 26 Oct 2022 18:21:02 +0200</pubDate><guid>http://www.wesleycamargo.com/p/how-to-create-a-dotnet-core-project-with-command-line/</guid><description>&lt;img src="https://cdn-images-1.medium.com/max/800/0*bpTSYTtQASQsZBf1" alt="Featured image of post How to create a dotnet core project with command line" />&lt;h3 id="how-to-create-a-dotnet-core-project-with-commandline">How to create a dotnet core project with command line
&lt;/h3>&lt;p>In this post, we will see how to simply create a dotnet core application using the command line. For that, we will use Windows Terminal with PowerShell, but it is possible to use any terminal for it :)&lt;/p>
&lt;p>&lt;img src="https://cdn-images-1.medium.com/max/800/0*bpTSYTtQASQsZBf1"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@lordarcadius?utm_source=medium&amp;amp;utm_medium=referral" target="_blank" rel="noopener"
>Vipul Jha&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="installing-dotnet-core-with-commandline">Installing dotnet core with command line
&lt;/h3>&lt;p>Install dotnet core with the command line is quite simple. For that, we will use Winget with the command below:&lt;/p>
&lt;h3 id="creating-dotnet-project-in-windowsterminal">Creating dotnet project in Windows Terminal
&lt;/h3>&lt;p>For this post, we will use Windows Terminal, but you can use any terminal that you want.&lt;/p>
&lt;p>Open the terminal in the directory that you want to create your project and type the command &lt;code>dotnet new webapp -n demo&lt;/code> . It will generate a directory called “**demo” **within the project structure.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-a-dotnet-core-project-with-command-line/1_08bKMGd2HDp7FNVYBkk1FA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Enter into the directory created and type &lt;code>code .&lt;/code> . This command will open the Visual Studio Code in your project directory:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-a-dotnet-core-project-with-command-line/1_TXv2VCIEUCL6IB1HJ1Z9hg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>In the VS Code is possible to see the project structure, as we can see below:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-a-dotnet-core-project-with-command-line/1_40oFqCrIUrJMRJjI0txVOA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="how-to-build-and-run-a-dotnet-core-projectlocally">How to build and run a dotnet core project locally
&lt;/h3>&lt;p>Now let’s build our dotnet project to ensure everything is working properly. The easiest way to do that is using the integrated terminal in VS Code.&lt;/p>
&lt;p>To open the terminal type &lt;code>ctrl + `` or go to **View &amp;gt; Terminal. **In the terminal that will appear at the bottom of your VS Code, type the command &lt;/code>dotnet build` . If everything goes well you should see the **Build succeeded **message.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-a-dotnet-core-project-with-command-line/1_Ay0Vk78CsEux4r2KuxV2PQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>We can now run our web app with the command &lt;code>dotnet run&lt;/code> . It will start the web app locally in some ports. You can copy one of them and open it on your browser:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-a-dotnet-core-project-with-command-line/1_Jtan4uZ740glcB0y3OXBEg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-a-dotnet-core-project-with-command-line/1_N21SjaR9uc_j1XBD2xOfpQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>In further posts, we will see more about DevOps practices, and having a real application to start with is crucial to understand all the steps that will be applied in a real-life scenario.&lt;/p>
&lt;p>I hope this post could be useful and see you in the next one!&lt;/p></description></item><item><title>How to create commits with different users in git</title><link>http://www.wesleycamargo.com/p/how-to-create-commits-with-different-users-in-git/</link><pubDate>Wed, 19 Oct 2022 23:12:09 +0200</pubDate><guid>http://www.wesleycamargo.com/p/how-to-create-commits-with-different-users-in-git/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-commits-with-different-users-in-git/1_fLG0WrzYU-ZuAkqAKqT__A.jpeg" alt="Featured image of post How to create commits with different users in git" />&lt;h3 id="how-to-create-commits-with-different-users-ingit">How to create commits with different users in git
&lt;/h3>&lt;p>In my previous &lt;a class="link" href="https://faun.pub/how-to-setup-your-environment-with-git-and-vs-code-with-choco-23d90f598d24" target="_blank" rel="noopener"
>post&lt;/a>, I showed among other stuff how to configure your git credentials. But in case you need to use different users in different projects or repositories, you need to be sure that your commits are using the correct credentials. Check on this post how to configure it properly and stop messing up your repos ;)&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-commits-with-different-users-in-git/1_fLG0WrzYU-ZuAkqAKqT__A.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@yancymin?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Yancy Min&lt;/a> on &lt;a class="link" href="https://unsplash.com/@yancymin?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;p>I know a lot of people that already made a commit using the wrong credentials in either work or personal repos. Having to remember to configure this in every new repository is not the best way to do that.&lt;/p>
&lt;p>For this, we can use &lt;a class="link" href="https://git-scm.com/docs/git-config#_conditional_includes" target="_blank" rel="noopener"
>Conditional Includes&lt;/a> when creating our config file. This is a bit more complex than just setting the user and email, but it will help you to avoid a lot of work, in case you need to rewrite your commit history later :).&lt;/p>
&lt;h3 id="understanding-the-git-configuration">Understanding the git configuration
&lt;/h3>&lt;p>The git configuration is used to introduce customized behaviors on git and it has three different scopes of settings:&lt;/p>
&lt;ul>
&lt;li>**System **— In this scope, the settings are applied to all users and all repositories. To edit this scope use the parameter &lt;code>--system&lt;/code> . To verify which configurations are in the system scope, type the command &lt;code>git config --system -l&lt;/code>&lt;/li>
&lt;li>**Global **— This is the user scope, where it is possible to customize settings using the parameter &lt;code>--global&lt;/code> , and it is applied to all repositories of that user. The global configuration file sits in the user directory on your computer.&lt;/li>
&lt;li>&lt;strong>Local&lt;/strong>— Each repository can also have its own customized settings. It is possible to find the configuration file in the git directory inside each repository &lt;code>./.git/config&lt;/code> , or it is also possible to check with the parameter&lt;code>--local&lt;/code> .&lt;/li>
&lt;/ul>
&lt;p>The lower the scope, the higher the priority, so it means that the local scope overrides the global scope, and the global overrides the system scope. With that said, the precedence is in the following order: &lt;strong>System&lt;/strong>&amp;gt; **Global **&amp;gt; &lt;strong>Local&lt;/strong>&lt;/p>
&lt;p>It is possible to trace back from where the configuration is coming from: &lt;code>git config -l --show-origin&lt;/code>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-commits-with-different-users-in-git/1_Y_rGL86RNTws8Z7qeAD59Q.png"
loading="lazy"
alt="Image"
>
Different scopes of configuration — Image by author&lt;/p>
&lt;p>In our case, we will play around with the user&amp;rsquo;s configurations. These configurations are stored in a file &lt;code>.gitconfig&lt;/code> that sits in your user directory, as mentioned above. To easily access it, you can type &lt;code>~/.gitconfig&lt;/code> in your terminal and you will be able to see something similar to this:&lt;/p>
&lt;h3 id="creating-the-conditional-includes-in-gitconfig">Creating the conditional includes in gitconfig
&lt;/h3>&lt;p>For each user we want to use, it is necessary to create a separate folder, where the repositories will sit. This is because we will use the directory that git specifies in its configuration to identify where we are. In my example, I will configure my global email, which will be used for all repositories, except those under the folder &lt;code>c:\repos\work&lt;/code> .&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-commits-with-different-users-in-git/1_rW4Zp3L7W8fYOY94dmpV5w.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>With our work repositories under the correct folder, we need to create a specific configuration file for that “profile”. You can type the command &lt;code>echo [user] &amp;gt; ~/work.gitconfig&lt;/code>to create it under your user directory. After creation, populate with needed information for the profile, as per below:&lt;/p>
&lt;p>After creating the &lt;code>work.gitconfig&lt;/code> file, in your main file (&lt;code>.gitconfig&lt;/code>), include the &lt;code>[includeIf]&lt;/code> session. The command &lt;code>gitdir/i&lt;/code> will return the directory of your repository, and if it matches the directory that you specified, it will load the &lt;code>work.gitconfig&lt;/code> .&lt;/p>
&lt;h3 id="concluding">Concluding…
&lt;/h3>&lt;p>This configuration is quite simple, but can be very helpful if you work in many projects simultaneously . I hope it can help somehow and see you in the next post!&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-create-commits-with-different-users-in-git/0_nTpwFrWVp057bnqw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇&lt;/p>
&lt;h3 id="join-faun--get-similar-stories-in-your-inbox-eachweekhttpfromfauntor8zxxd">🚀&lt;a class="link" href="http://from.faun.to/r/8zxxd" target="_blank" rel="noopener"
>Join FAUN &amp;amp; get similar stories in your inbox each week&lt;/a>
&lt;/h3></description></item><item><title>How to setup your environment with git and VS Code with choco</title><link>http://www.wesleycamargo.com/p/how-to-setup-your-environment-with-git-and-vs-code-with-choco/</link><pubDate>Mon, 10 Oct 2022 15:10:04 +0200</pubDate><guid>http://www.wesleycamargo.com/p/how-to-setup-your-environment-with-git-and-vs-code-with-choco/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/how-to-setup-your-environment-with-git-and-vs-code-with-choco/1_fLG0WrzYU-ZuAkqAKqT__A.jpeg" alt="Featured image of post How to setup your environment with git and VS Code with choco" />&lt;h3 id="how-to-setup-your-environment-with-git-and-vs-code-withchoco">How to setup your environment with git and VS Code with choco
&lt;/h3>&lt;p>Configuring your git environment is something very important to begin using version control. In this post, I will show you, step by step, how to install and configure git correctly and also how to use Visual Studio Code as a default editor, And at the end of the post, there are the full scripts to help you set up your environment, **with a bonus **in it ;).&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-setup-your-environment-with-git-and-vs-code-with-choco/1_fLG0WrzYU-ZuAkqAKqT__A.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@yancymin?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Yancy Min&lt;/a> on &lt;a class="link" href="https://unsplash.com/s/photos/git?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-install-git-and-visual-studio-code-with-powershell-andchoco">How to install git and Visual Studio Code with PowerShell and Choco
&lt;/h3>&lt;h4 id="how-to-install-chocolatey-with-powershell">How to install Chocolatey with PowerShell
&lt;/h4>&lt;p>Before we proceed with git and VSCode, first we need to install the Chocolatey. &lt;a class="link" href="https://community.chocolatey.org/" target="_blank" rel="noopener"
>Chocolatey&lt;/a>, or simply Choco, is a package installer designed for work with PowerShell.&lt;/p>
&lt;p>The easiest way to install choco is by running a PowerShell script in your terminal. Below I have prepared a script that calls the official Choco script on its site:&lt;/p>
&lt;h3 id="how-to-install-git-on-windows-usingchoco">How to install git on Windows using choco
&lt;/h3>&lt;p>After installing Choco, we will be able to install the git package available there. To install, the command is very straightforward as we can see below (might be necessary to run the command with administrative privileges):&lt;/p>
&lt;p>After the installation, check if git was correctly installed with the command &lt;code>git -v&lt;/code> :&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-setup-your-environment-with-git-and-vs-code-with-choco/1_n_lAcHewgubjgsb-KeoXLw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>If you receive an error saying that git is not installed, close and reopen your terminal, it will reload the environment variables with the correct git path.&lt;/p>
&lt;h3 id="how-to-install-visual-studio-code-with-choco-and-powershell">How to install Visual Studio Code with choco and PowerShell
&lt;/h3>&lt;p>As well we saw to install git, the command to install VSCode with choco and PowerShell is also very simple:&lt;/p>
&lt;p>To check the installation, use the command &lt;code>code -v&lt;/code> . Again, in case of any problem, close and reopen your terminal.&lt;/p>
&lt;h3 id="how-to-setup-git-credentials">How to setup git credentials
&lt;/h3>&lt;h4 id="how-to-setup-git-username-andemail">How to setup git username and email
&lt;/h4>&lt;p>To associate your identity with your commits, it is necessary to define your git user name and email. You can configure it in different scopes, below we can see how to configure it globally:&lt;/p>
&lt;h3 id="how-to-setup-visual-studio-code-as-the-default-giteditor">How to setup Visual Studio Code as the default git editor
&lt;/h3>&lt;p>The default editor for git is nano. Personally, I prefer VS Code, as it has several extensions that can improve productivity. In the script below, we are setting up the VSCode as the default tool for the command diff and merge and also as the default editor:&lt;/p>
&lt;h3 id="how-to-install-and-configure-git-and-vs-code-with-powershell-script">How to install and configure Git and VS Code with PowerShell Script
&lt;/h3>&lt;h4 id="installation">Installation
&lt;/h4>&lt;p>To install all necessary tools, you can simply run the script below. Might be necessary to have administrator permissions for that. In the first 6 lines, the script installs choco, and then uses choco to install git and vscode:&lt;/p>
&lt;h4 id="configuration">Configuration
&lt;/h4>&lt;p>After installing the tools, you may need to reload your terminal, as I said above, so to make it easier I created two different scripts 😉. As a &lt;strong>Bonus,&lt;/strong> I also added an alias to a command &lt;code>git lg&lt;/code>, which is an alias for &lt;code>git log&lt;/code> , but using prettier options. You can check more about it on this post &lt;a class="link" href="https://faun.pub/creating-a-pretty-git-log-61f312f45201" target="_blank" rel="noopener"
>Creating a pretty git log&lt;/a>:&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Source control is the basis of any DevOps process, and git is currently the most used tool for it. Using the right configuration together with VS Code will help to start this journey!&lt;/p>
&lt;h3 id="references">References
&lt;/h3>&lt;p>&lt;a class="link" href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" target="_blank" rel="noopener"
>Git — Installing Git (git-scm.com)&lt;/a>&lt;/p>
&lt;p>&lt;a class="link" href="https://docs.chocolatey.org/en-us/" target="_blank" rel="noopener"
>Chocolatey Software Docs | Chocolatey — Software Management for Windows&lt;/a>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-setup-your-environment-with-git-and-vs-code-with-choco/0_3ahp0-lW18WfoBhc.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇&lt;/p>
&lt;h3 id="join-faun--get-similar-stories-in-your-inbox-eachweekhttpfromfauntor8zxxd">🚀&lt;a class="link" href="http://from.faun.to/r/8zxxd" target="_blank" rel="noopener"
>Join FAUN &amp;amp; get similar stories in your inbox each week&lt;/a>
&lt;/h3></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>Como funcionam os Loops — Developer BR — Corujinhas</title><link>http://www.wesleycamargo.com/p/como-funcionam-os-loops-developer-br-corujinhas/</link><pubDate>Wed, 27 Jul 2022 23:48:29 +0200</pubDate><guid>http://www.wesleycamargo.com/p/como-funcionam-os-loops-developer-br-corujinhas/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/como-funcionam-os-loops-e-developer-br-e-corujinhas/0_hgbUwY6z642w44jS.png" alt="Featured image of post Como funcionam os Loops — Developer BR — Corujinhas" />&lt;h3 id="como-funcionam-os-loopsdevelopers-brcorujinhas">Como funcionam os Loops — Developers BR — Corujinhas
&lt;/h3>&lt;h3 id="loops">Loops
&lt;/h3>&lt;h4 id="o-que-é-um-loop-oulaço">O que é um loop ou laço?
&lt;/h4>&lt;p>Um loop é uma maneira de executar um trecho código repetidas vezes. É composto de uma condição e o código que será executado.&lt;/p>
&lt;p>O loop é representado por um circuito fechado, e enquanto a condição não for satisfeita se repete infinitamente.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-funcionam-os-loops-e-developer-br-e-corujinhas/0_hgbUwY6z642w44jS.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="condições-de-umloop">Condições de um loop
&lt;/h4>&lt;p>As condições são usadas para verificar quantas vezes o trecho de código será repetido. Antes de cada execução (ou depois, dependendo do tipo da estrutura de repetição usada), a condição é verificada e se continuar verdadeira o código é executado. Os tipo de condições podem ser:&lt;/p>
&lt;ul>
&lt;li>Verdadeiro ou Falso&lt;/li>
&lt;li>Um número específico de vezes&lt;/li>
&lt;li>O número de elementos em uma coleção&lt;/li>
&lt;/ul>
&lt;h4 id="código">Código
&lt;/h4>&lt;p>Praticamente qualquer tipo de código pode ser executado em um loop, não há restrições! Em alguns casos, certos tipos de variáveis são usadas para ajudar a controlar o que está acontecendo durante as repetições. Essa variável é chamada de &lt;strong>contador&lt;/strong>.&lt;/p>
&lt;h4 id="quando-usar-umloop">Quando usar um loop
&lt;/h4>&lt;p>Usamos loops quando precisamos fazer a mesma coisa várias vezes. Vamos a um exemplo:&lt;/p>
&lt;p>Imagine que estamos criando um sistema para uma cafeteria. Os requisitos para esse sistema são:&lt;/p>
&lt;ul>
&lt;li>Para cada novo café pedido escrever na tela o número do pedido que está sendo executado&lt;/li>
&lt;li>Ao final exibir a quantidade total de cafés preparados&lt;/li>
&lt;/ul>
&lt;p>Para simplificar, vamos imaginar que temos 3 pedidos de café e precisamos executá-los. Como seria esse código?&lt;/p>
&lt;p>&lt;code>int cafesPreparados = 0;&lt;/code>&lt;/p>
&lt;p>&lt;code>ash &lt;/code>// Preparando o café
cafesPreparados++;
Console.WriteLine($&amp;ldquo;Preparando o 1° café&amp;rdquo;);&lt;code> &lt;/code>&lt;/p>
&lt;p>&lt;code>ash &lt;/code>cafesPreparados++;
Console.WriteLine($&amp;ldquo;Preparando o 2° café&amp;rdquo;);&lt;code> &lt;/code>&lt;/p>
&lt;p>&lt;code>ash &lt;/code>cafesPreparados++;
Console.WriteLine($&amp;ldquo;Preparando o 3° café&amp;rdquo;);&lt;code> &lt;/code>&lt;/p>
&lt;p>&lt;code>ash &lt;/code>Console.WriteLine($&amp;ldquo;Total de devs felizes: {cafesPreparados}&amp;rdquo;);&lt;code> &lt;/code>
Não parece tão complicado, certo? Realmente, se tivermos poucos pedidos não é uma tarefa difícil, mas temos dois problemas:&lt;/p>
&lt;ul>
&lt;li>No caso de apenas 3 pedidos, foram apenas mais 6 linhas de código, mas e se fossem 100? Ou 1000? Teremos um programador bem entediado repetindo esse código tantas vezes…&lt;/li>
&lt;li>Além do problema acima, de termos tarefas repetitivas, nós adicionamos dentro do código cada pedido feito - O que impede de recebermos pedidos dinamicamente e na pratica inviabiliza a aplicação.&lt;/li>
&lt;/ul>
&lt;p>Mas imagine que agora nossa cafeteria aceita pedidos online, e recebeu 10000 pedidos. Como fazer isso?&lt;/p>
&lt;p>É nessa situação que os loops vão te ajudar!&lt;/p>
&lt;h3 id="tipos-deloops">Tipos de loops
&lt;/h3>&lt;h4 id="while">While
&lt;/h4>&lt;p>É o tipo mais básico de loop. No while, a condição é verificada antes da execução, e se for verdadeira o código é executado. Normalmente é usado para comparações de verdadeiro e falso mas com um pouco mais de trabalho, ele consegue substituir algumas das outras estruturas de repetição, como for e forEach.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-funcionam-os-loops-e-developer-br-e-corujinhas/0_GaTv8RxkcfvejFwH.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>As principais características do while são:&lt;/p>
&lt;ul>
&lt;li>Enquanto uma condição for verdadeira(ou falsa), continue repetindo.&lt;/li>
&lt;li>Executa o trecho de código uma vez, volta ao inicio e verifica se a condição continua verdadeira e executa novamente.&lt;/li>
&lt;li>Atenção! Isso pode acontecer para sempre, desde que a condição continue verdadeira! Isso é chamado de loop infinito e na maioria dos casos não é desejado.&lt;/li>
&lt;/ul>
&lt;p>&lt;code>ash Console.WriteLine(&amp;quot;Quantos devs precisam de café?&amp;quot;); *int* devs = Convert.ToInt32(Console.ReadLine()); &lt;/code>&lt;/p>
&lt;p>&lt;code>ash *int* cafesPreparados = 0; &lt;/code>&lt;/p>
&lt;p>&lt;code>ash while (cafesPreparados &amp;lt; devs) { cafesPreparados++; Console.WriteLine($&amp;quot;Preparando o {cafesPreparados}° café&amp;quot;); } &lt;/code>&lt;/p>
&lt;p>&lt;code>ash Console.WriteLine($&amp;quot;Total de devs felizes: {cafesPreparados}&amp;quot;); &lt;/code>&lt;/p>
&lt;h4 id="do-while">Do While
&lt;/h4>&lt;p>Para do while, acontece o oposto, o código é executado e apenas após a condição é verificada. Isso pode ser útil em casos onde pelo menos uma execução é sempre necessária.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-funcionam-os-loops-e-developer-br-e-corujinhas/0_7FpTKrY1o27XneqV.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;code>ash Console.WriteLine(&amp;quot;Quantos devs precisam de café?&amp;quot;); *int* devs = Convert.ToInt32(Console.ReadLine()); &lt;/code>&lt;/p>
&lt;p>&lt;code>ash *int* cafesPreparados = 0; &lt;/code>&lt;/p>
&lt;p>&lt;code>ash do { cafesPreparados++; Console.WriteLine($&amp;quot;Preparando o {cafesPreparados}° café&amp;quot;); } while (cafesPreparados &amp;lt; devs); &lt;/code>&lt;/p>
&lt;p>&lt;code>ash if (cafesPreparados &amp;gt; devs) { Console.WriteLine($&amp;quot;Oh não! O café está esfriando e nenhum dev está por perto!&amp;quot;); } else { Console.WriteLine($&amp;quot;Total de devs felizes: {cafesPreparados}&amp;quot;); } &lt;/code>&lt;/p>
&lt;h4 id="for">For
&lt;/h4>&lt;p>O for funciona da mesma maneira que o while. É recomendado seu uso para casos em que a quantidade de vezes que a repetição deve acontecer é conhecida. Para declarar um for é necessária uma variável, chamada index ou i e são necessárias 3 declarações separadas por ponto e vírgula(;):&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/como-funcionam-os-loops-e-developer-br-e-corujinhas/0_TcDDIvQkLXBxHr-T.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;ul>
&lt;li>Inicializar: Declaramos o valor inicial do índice&lt;/li>
&lt;li>Condição: Adicionamos a comparação que será usada para parar o loop&lt;/li>
&lt;li>Iterar: Incrementamos o índice, normalmente com ++&lt;/li>
&lt;/ul>
&lt;p>&lt;code>ash Console.WriteLine(&amp;quot;Quantos devs precisam de café?&amp;quot;); *int* devs = Convert.ToInt32(Console.ReadLine()); &lt;/code>&lt;/p>
&lt;p>&lt;code>ash *int* cafesPreparados = 0; &lt;/code>&lt;/p>
&lt;p>&lt;code>ash for (*int* i = 0; i &amp;lt; devs; i++) { Console.WriteLine($&amp;quot;Preparando o {i}° café&amp;quot;); cafesPreparados = i; } &lt;/code>&lt;/p>
&lt;p>&lt;code>ash Console.WriteLine($&amp;quot;Total de devs felizes: {cafesPreparados}&amp;quot;); &lt;/code>&lt;/p>
&lt;h4 id="foreach">Foreach
&lt;/h4>&lt;p>O foreach é recomendado quando trabalhamos com coleções ou listas. Sua tradução é “para cada”, o que significa o trecho de código será repetido uma vez para cada elemento da lista.&lt;/p>
&lt;p>&lt;code>ash var developers = new List&amp;lt;*string*&amp;gt;(); *string* maisdevs = &amp;quot;s&amp;quot;; &lt;/code>&lt;/p>
&lt;p>&lt;code>ash do { Console.WriteLine(&amp;quot;Digite o nome do dev:&amp;quot;); developers.Add(Console.ReadLine() as *string* ?? string.Empty); &lt;/code>&lt;/p>
&lt;p>&lt;code>ash Console.WriteLine(&amp;quot;Mais algum dev precisa de café? [S/N]&amp;quot;); maisdevs = Console.ReadLine() as *string* ?? string.Empty; } while (maisdevs.ToLower().Equals(&amp;quot;s&amp;quot;)); &lt;/code>&lt;/p>
&lt;p>&lt;code>ash foreach (var dev in developers) { Console.WriteLine($&amp;quot;Preparando café para o dev {dev}&amp;quot;); } &lt;/code>&lt;/p>
&lt;p>&lt;code>ash Console.WriteLine($&amp;quot;Total de devs felizes: {developers.Count}&amp;quot;); &lt;/code>&lt;/p>
&lt;h3 id="github-do-corujinhas">GitHub do Corujinhas
&lt;/h3>&lt;p>Para os exemplos completos, veja o repositório do corujinhas no GitHub!
&lt;a class="link" href="https://github.com/Developers-BR/corujinhas" target="_blank" rel="noopener"
>Developers-BR/corujinhas (github.com)&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>It’s time to tidy up your code: How to use Visual Studio Code Autoformat</title><link>http://www.wesleycamargo.com/p/its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat/</link><pubDate>Wed, 16 Mar 2022 12:25:13 +0100</pubDate><guid>http://www.wesleycamargo.com/p/its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat/1_N_tA9AjjjsJm1w_h2pPghQ.jpeg" alt="Featured image of post It’s time to tidy up your code: How to use Visual Studio Code Autoformat" />&lt;h3 id="its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat">It’s time to tidy up your code: How to use Visual Studio Code Autoformat
&lt;/h3>&lt;p>&lt;img src="http://www.wesleycamargo.com/img/its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat/1_N_tA9AjjjsJm1w_h2pPghQ.jpeg"
loading="lazy"
alt="Image"
>
Photo by &lt;a class="link" href="https://unsplash.com/@hocza?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Jozsef Hocza&lt;/a> on &lt;a class="link" href="https://unsplash.com/s/photos/broom?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" target="_blank" rel="noopener"
>Unsplash&lt;/a>&lt;/p>
&lt;p>If you are like me and like to have consistency in formatting your code, this is definitely a must to have configuration.&lt;/p>
&lt;p>By default, you can use VS code formatters with the shortcut &lt;code>Alt+Shift+F&lt;/code> but, you can also configure it to format every time you save your file, like this:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat/1_BGAaZ9S8L34Ju1fHOxV56Q.gif"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="how-to-enable-autoformat-on-visual-studiocode">How to enable autoformat on Visual Studio Code
&lt;/h3>&lt;p>There are two options to enable autoformat by UI and editing settings.json file, let’s check both:&lt;/p>
&lt;h4 id="how-to-edit-autoformat-option-on-vs-code-user-interface">How to edit autoformat option on VS Code User Interface
&lt;/h4>&lt;p>Open the menu &lt;code>File-&amp;gt;Preferences-&amp;gt;Settings&lt;/code> and under Text Editor look for &lt;code>Formating&lt;/code> and enable the option &lt;code>Format On Save&lt;/code> choosing which option is better on &lt;code>Format On Save Mode&lt;/code> .&lt;/p>
&lt;p>If you’re using version control, you can choose to format changes only, this is particularly useful if you’re working on legacy code and don’t want to change a large file at once. For this option choose &lt;code>modificationsIfAvailable&lt;/code> .&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat/1_wet4EZdGEKs4L2FqZathyg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="how-to-edit-autoformat-option-on-vs-code-settingsjson">How to edit autoformat option on VS Code settings.json
&lt;/h4>&lt;p>To find settings.json file, open your Visual Studio Code and press F1:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat/1_6e0UH_No8bBsxSamdTcy2A.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Now type &lt;code>settings.json &lt;/code>, open the file and add the section:&lt;/p>
&lt;p>For the configuration&lt;code>Format On Save Mode&lt;/code> you can pick of the of the options below:&lt;/p>
&lt;ul>
&lt;li>file&lt;/li>
&lt;li>modifications&lt;/li>
&lt;li>modificationsIfAvailable&lt;/li>
&lt;/ul>
&lt;p>This is how your file should look like:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat/1_NFY7b7pWnYaRY68q3Tsheg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>This configuration applies to most part of the supported languages, like PowerShell, JSON, C#, and others.&lt;/p>
&lt;h3 id="how-to-autoformat-terraform-files-on-visual-studiocode">How to autoformat Terraform files on Visual Studio Code
&lt;/h3>&lt;p>Although the configuration above works for most languages if you are using terraform you need additional configurations. The plugin also doesn’t have a UI for it, so we need to add the configuration manually in the file settings.json.&lt;/p>
&lt;p>To do it, open again the &lt;code>settings.json&lt;/code> file and add the following sections:&lt;/p>
&lt;p>Pay attention that you must add one section for Terraform, and one more for terraform-vars.&lt;/p>
&lt;p>This is the final file:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat/1_61hu0VbbIpGNiVOXYJz29w.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="conclusion">Conclusion
&lt;/h3>&lt;p>Autoformatting is an easy and helpful option that will for sure help your team to have consistency and keep your codebase tidy and clean.&lt;/p>
&lt;p>See you in the next post!
[&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/its-time-to-tidy-up-your-code-how-to-use-visual-studio-code-autoformat/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>DataOps Automation — Accessing Databricks API with AAD Service Principal Name</title><link>http://www.wesleycamargo.com/p/dataops-automation-accessing-databricks-api-with-aad-service-principal-name/</link><pubDate>Sat, 29 May 2021 16:24:43 +0200</pubDate><guid>http://www.wesleycamargo.com/p/dataops-automation-accessing-databricks-api-with-aad-service-principal-name/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-accessing-databricks-api-with-aad-service-principal-name/1_r4Rwmx79PqTVP7A3ZlN8LA.png" alt="Featured image of post DataOps Automation — Accessing Databricks API with AAD Service Principal Name" />&lt;h3 id="dataops-automationaccessing-databricks-api-with-aad-service-principal-name">DataOps Automation — Accessing Databricks API with AAD Service Principal Name
&lt;/h3>&lt;p>Databricks is an Apache Spark tool for data engineering used to process and transform large amounts of data and explore running machine learning models.&lt;/p>
&lt;p>In this post I’ll show how to call databricks API’s, an important resource to automate the deployment and resources creation.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/dataops-automation-e-accessing-databricks-api-with-aad-service-principal-name/1_r4Rwmx79PqTVP7A3ZlN8LA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="preparing-tokens">Preparing Tokens
&lt;/h3>&lt;p>Yes, you read it right token&lt;strong>s&lt;/strong> in the plural, we need more than one token to perform authentication.&lt;/p>
&lt;p>Actually, if your SPN is a user in your databricks workspace only the AAD token should be enough, but I believe that in most situations if you want to automate from scratch your workspace it will not be the case.&lt;/p>
&lt;h4 id="creating-aadtoken">Creating AAD token
&lt;/h4>&lt;p>To create an AAD token it´s necessary the tenant Id of your subscription, an SPN Id, and SPN secret. If you don’t know how to create a Service Principal Name check it out here &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal" target="_blank" rel="noopener"
>Create an Azure AD app &amp;amp; service principal in the portal — Microsoft identity platform | Microsoft Docs&lt;/a>&lt;/p>
&lt;p>For this, I have created the function below, as we will use it more than once.&lt;/p>
&lt;h4 id="preparing-httpheader">Preparing HTTP header
&lt;/h4>&lt;p>As I mentioned before, we need two AAD Tokens if our SPN is not added as a user into databricks.&lt;/p>
&lt;p>The first token is a databricks token. To create that we need to provide the databricks resource id (2ff814a6–3304–4ab8–85cb-cd0e6f879c1d).&lt;/p>
&lt;p>If your SPN is a user in your databricks workspace, only this token should be enough.&lt;/p>
&lt;p>The second one is the management endpoint token you also need to provide the resource id, in this case, it should be “&lt;a class="link" href="https://management.core.windows.net/" target="_blank" rel="noopener"
>https://management.core.windows.net/&lt;/a>”. Additionally, your SPN must have Contributor or Owner permissions on your databricks.&lt;/p>
&lt;p>&lt;strong>Creating the databricks Personal Access Token&lt;/strong>&lt;/p>
&lt;p>With our header prepared, you just need to call the databricks API, consuming the methods that you need.&lt;/p>
&lt;p>&lt;strong>Complete Script&lt;/strong>&lt;/p>
&lt;p>Below you can find the complete script, including the auxiliar functions :)&lt;/p>
&lt;p>I hope it can help you, and see you in next post!&lt;/p></description></item><item><title>Creating a pretty git log</title><link>http://www.wesleycamargo.com/p/creating-a-pretty-git-log/</link><pubDate>Sat, 01 May 2021 12:33:52 +0200</pubDate><guid>http://www.wesleycamargo.com/p/creating-a-pretty-git-log/</guid><description>&lt;h3 id="creating-a-pretty-gitlog">Creating a pretty git log
&lt;/h3>&lt;p>Do you know git lg command? Git log command is very helpful, but sometimes, it can be a bit tricky to have a good view of your history tree. I’ll show with simple commands how to improve that and create your customized log message :).&lt;/p>
&lt;p>The default git log command brings a lot of useful information, as we can see in the picture below. But when you need to know which branch your commit was originally created, it didn’t give you a good tree view of that.&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>How to collect Business Information in Application Insights</title><link>http://www.wesleycamargo.com/p/how-to-collect-business-information-in-application-insights/</link><pubDate>Sun, 03 Jan 2021 16:06:38 +0100</pubDate><guid>http://www.wesleycamargo.com/p/how-to-collect-business-information-in-application-insights/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/how-to-collect-business-information-in-application-insights/1_Q236l-ogEMAxUQUTxLoV6A.png" alt="Featured image of post How to collect Business Information in Application Insights" />&lt;h3 id="monitoring---how-to-collect-business-information-in-application-insights">Monitoring - How to collect Business Information in Application Insights
&lt;/h3>&lt;p>Sometimes you have business requirements to know how many times something happened. An easy way to do that is by using Application Insights Telemetry. In this post, we will see how to do this configuration.&lt;/p>
&lt;h4 id="creating-the-azure-application-insights">Creating the Azure Application Insights
&lt;/h4>&lt;p>Create a new Application Insights in your Azure account. You can create with the ARM Template below:&lt;/p>
&lt;p>To run the ARM Template with Az CLI, you can use these commands:&lt;/p>
&lt;p>az group create -n RG-Samples -l northeurope
az deployment group create -g RG-Samples — template-file .\appInsights.jsonIt will return an Instrumentation Key as output, save this value to use later.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-collect-business-information-in-application-insights/1_Q236l-ogEMAxUQUTxLoV6A.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="creating-the-asp-netproject">Creating the Asp Net Project
&lt;/h4>&lt;p>Create a new MVC application and add the package Microsoft.ApplicationInsights.AspNetCore:&lt;/p>
&lt;p>dotnet new mvc
dotnet add package Microsoft.ApplicationInsights.AspNetCoreNow in the Startup.cs file, we need to configure the Application Insights Telemetry.&lt;/p>
&lt;p>Go to the method ConfigureServices and add the line &lt;code>services.AddApplicationInsightsTelemetry();&lt;/code>&lt;/p>
&lt;p>At the end of the file Views/Home/Index.cshtml add a button to call the event:&lt;/p>
&lt;p>In the HomeController.cs, add a private variable with the type &lt;code>*TelemetryClient&lt;/code> and *add to the constructor a variable to assign it. Also, add a new method to call your Event Button.&lt;/p>
&lt;p>In the appSettings.json, replace the content as below and substituting the Instrumentation Key with the value collected in the steps above:&lt;/p>
&lt;h4 id="collecting-and-searching-data-in-application-insights">Collecting and searching data in Application Insights
&lt;/h4>&lt;p>Run the application with the command &lt;code>dotnet run&lt;/code> and open &lt;a class="link" href="https://localhost:5001" target="_blank" rel="noopener"
>https://localhost:5001&lt;/a> in your browser. Now click some times in Hello to generate data in the application insights:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-collect-business-information-in-application-insights/1_QEhqjDvoeaFCDf-j5tnvGg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/how-to-collect-business-information-in-application-insights/1_mLBIN--h0OCAHSrlEhiPSg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>In Azure Portal, open the Application Insights created, and click in search:&lt;/p></description></item><item><title>Az DevOps YAML Pipelines — Creating a Multi Source pipeline with GitHub Repositories</title><link>http://www.wesleycamargo.com/p/az-devops-yaml-pipelines-creating-a-multi-source-pipeline-with-github-repositories/</link><pubDate>Sun, 20 Dec 2020 01:21:03 +0100</pubDate><guid>http://www.wesleycamargo.com/p/az-devops-yaml-pipelines-creating-a-multi-source-pipeline-with-github-repositories/</guid><description>&lt;h3 id="az-devops-yaml-pipelinescreating-a-multi-source-pipeline-with-github-repositories">Az DevOps YAML Pipelines — Creating a Multi Source pipeline with GitHub Repositories
&lt;/h3>&lt;p>Sometimes should be necessary to use more than one repository in our deployment pipelines. Maybe you are deploying resources from different repositories together, or maybe you have a script repo with some reusable tools.&lt;/p>
&lt;p>But when we create a YAML pipeline, by default it just checkout the repo on what our YAML is versioned, so it´s necessary to add a second repo, and below we will see how to do it =).&lt;/p>
&lt;p>If you don´t know how to create a basic YAML pipeline, you can learn this here: &lt;a class="link" href="https://docs.microsoft.com/en-us/azure/devops/pipelines/create-first-pipeline?view=azure-devops&amp;amp;tabs=net%2Ctfs-2018-2%2Cbrowser" target="_blank" rel="noopener"
>Create your first pipeline — Azure Pipelines | Microsoft Docs&lt;/a>&lt;/p>
&lt;p>In this example, I´ll use two GitHub repositories, the first one has my App Code and the YAML pipeline, and the second one has some PowerShell scripts.&lt;/p>
&lt;p>We can see the initial build YAML below:&lt;/p>
&lt;p>During the build execution of this pipeline, we can see that we have an “auto checkout”, that is not required any additional configuration.&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>Pessoas - A parte mais complexa do DevOps</title><link>http://www.wesleycamargo.com/p/pessoas-a-parte-mais-complexa-do-devops/</link><pubDate>Tue, 05 May 2020 19:11:47 +0200</pubDate><guid>http://www.wesleycamargo.com/p/pessoas-a-parte-mais-complexa-do-devops/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/pessoas-a-parte-mais-complexa-do-devops/0_Taa63z60tEhceJBY.png" alt="Featured image of post Pessoas - A parte mais complexa do DevOps" />&lt;h4 id="como-tornar-sua-equipe-mais-eficiente">Como tornar sua equipe mais eficiente
&lt;/h4>&lt;h3 id="por-que-pessoas-são-a-parte-mais-complexa-dodevops">Por que pessoas são a parte mais complexa do DevOps?
&lt;/h3>&lt;p>Pessoas é** **um dos três pilares do DevOps e frequentemente é o que apresenta maior dificuldade para que o resultado seja alcançado dentro das empresas. Mas por que isso ocorre e o que não adotar de DevOps pode causar?&lt;/p>
&lt;h4 id="equipes-separadas-objetivos-diferentes">Equipes separadas, objetivos diferentes
&lt;/h4>&lt;p>Quem já trabalhou em empresas que ainda não implementam DevOps, já deve ter presenciado algumas situação em que as equipes de desenvolvimento e infraestrutura se comportam como rivais. Isso acontece pois as equipes estão divididas em &lt;strong>Silos&lt;/strong>, e cada um desses silos possuem objetivos diferentes:&lt;/p>
&lt;ul>
&lt;li>**Desenvolvimento **normalmente é cobrada por entregar software cada vez mais rápido para atender as demandas de mercado.&lt;/li>
&lt;li>**Infraestrutura **tem a responsabilidade de manter a casa em ordem, com todas as aplicações estáveis, confiáveis e seguras para o cliente.&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/pessoas-a-parte-mais-complexa-do-devops/0_Taa63z60tEhceJBY.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Com silos possuindo objetivos opostos, cada equipe irá trabalhar para cumprir seu objetivo, o que ajuda a explicar o sentimento de rivalidade entre as equipes.&lt;/p>
&lt;p>Essa rivalidade é maléfica para o time. As pessoas em ambos os lados se sentem &lt;strong>desmotivadas&lt;/strong>, &lt;strong>sem o controle de seus próprios resultados&lt;/strong>, pois seu objetivo nunca pode ser cumprido sem ter que entrar em algum conflito com uma área que possui um objetivo diferente. Esse desgaste e desmotivação a longo prazo, faz os profissionais procurem ambientes mais sadios e com melhores condições, fazendo com que as empresas &lt;strong>percam os melhores profissionais&lt;/strong>.&lt;/p>
&lt;p>Além dos resultados ruins com as pessoas, a empresa também perde. Começam a aparecer os famosos “jeitinhos” para não depender da outra área, não são respeitados processos e etapas essenciais são menosprezadas. Esse tipo de comportamento pode causar falhas de comunicação, testes inadequados e culminar com maior quantidade de erros e redução na velocidade de entrega, o que &lt;strong>ironicamente&lt;/strong> &lt;strong>compromete o objetivo de ambas as áreas.&lt;/strong>&lt;/p>
&lt;p>&lt;strong>Não implementar&lt;/strong> novas versões mantém o ambiente estável, porém, &lt;strong>a&lt;/strong> &lt;strong>rapidez o que o mercado exige não é alcançada.&lt;/strong>
Por outro lado, implementar com mais frequência, significa &lt;strong>mais código sendo entregue&lt;/strong>, o que também significa que **mais comportamentos inesperados podem aparecer em produção **devido a proporção ser maior.&lt;/p></description></item><item><title>Criando um pipeline de CI/CD usando GitHub Actions</title><link>http://www.wesleycamargo.com/p/criando-um-pipeline-de-ci/cd-usando-github-actions/</link><pubDate>Sat, 02 May 2020 02:02:18 +0200</pubDate><guid>http://www.wesleycamargo.com/p/criando-um-pipeline-de-ci/cd-usando-github-actions/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_ui0WEO_7OKSGgN2M9PbE4A.png" alt="Featured image of post Criando um pipeline de CI/CD usando GitHub Actions" />&lt;h3 id="criando-um-pipeline-de-cicd-usando-githubactions">Criando um pipeline de CI/CD usando GitHub Actions
&lt;/h3>&lt;p>Nesse post vou demonstrar como criar uma aplicação DotNet core, versionar no GitHub, criar um workflow usando Actions e realizar deploy no Azure.&lt;/p>
&lt;p>Para acompanhar esse tutorial, você vai precisar de:&lt;/p>
&lt;ul>
&lt;li>Visual Studio Code - Pode ser baixado &lt;a class="link" href="https://code.visualstudio.com/download" target="_blank" rel="noopener"
>aqui&lt;/a>&lt;/li>
&lt;li>DotNet Core SDK - Pode ser baixado &lt;a class="link" href="https://dotnet.microsoft.com/download" target="_blank" rel="noopener"
>aqui&lt;/a>&lt;/li>
&lt;li>Uma conta no GitHub&lt;/li>
&lt;li>Uma conta no Azure&lt;/li>
&lt;/ul>
&lt;p>Todos os comandos realizados localmente estão no arquivo abaixo, mas irei explica-los um a um no decorrer do post&lt;/p>
&lt;h3 id="criando-a-aplicação">Criando a aplicação
&lt;/h3>&lt;p>Após cumpridos os pré reqs, abra o VS Code, vá em Open folder e selecione uma pasta vazia para criarmos o projeto:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_ui0WEO_7OKSGgN2M9PbE4A.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Agora vá no menu superior vá em **Terminal **-&amp;gt; **New Terminal **ou pressione &lt;em>ctrl + ‘,isso irá abrir um terminal na parte inferior da tela. Para verificar a versão do sdk instalada clique nele e digite:&lt;/em>&lt;/p>
&lt;p>dotnet &amp;ndash;version&lt;em>No meu caso estou utilizando a versão 3.1.201, caso tenha algum problema durante a execução do tutorial e esteja utilizando uma versão diferente, utilizar essa versão pode te ajudar.&lt;/em>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1__AAY-oPkIg9HbrwnsizM1A.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Agora para criarmos o projeto digite&lt;/p>
&lt;p>dotnet new webappEsse comando irá criar a estrutura da nossa aplicação que nada mais é que um site web baseado em MVC:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_WsYhHE1qwFyFqYPkK4QQbA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Repare que serão criados alguns arquivos na pasta que selecionamos no início. Eles podem ser vistos no menu Explorer ao lado esquerdo da tela&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_7qaqJxH-XhLcJ7imGQjFnQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Para verificar se tudo está ok com a aplicação, digite no terminal&lt;/p>
&lt;p>dotnet runIsso irá compilar e iniciar a aplicação. Aqui também pode ser verificado em qual porta está rodando e acessar para testar&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_KRkXlY-zDc8Y3KFVqLac2A.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_Yoclb52yTys4elRfRX_NpA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Agora que temos uma aplicação rodando, podemos seguir para a etapa de versionamento.&lt;/p>
&lt;p>Para mais informações sobre comandos do dotnet core veja o conteúdo deste link &lt;a class="link" href="https://docs.microsoft.com/pt-br/dotnet/core/tools/" target="_blank" rel="noopener"
>https://docs.microsoft.com/pt-br/dotnet/core/tools/&lt;/a>&lt;/p>
&lt;h3 id="adicionando-ao-github--controle-deversão">Adicionando ao GitHub / controle de versão
&lt;/h3>&lt;p>Antes de enviar nosso código ao GitHub, primeiro precisamos versionar localmente. Antes de realizar esse versionamento, vamos criar um arquivo chamado &lt;em>.gitignore&lt;/em>, onde iremos informar ao git, quais arquivos não queremos que sejam enviados, como binários por exemplo. O próprio dotnet Core possui um template pronto, onde automaticamente são adicionados os arquivos que não queremos versionar. No terminal digite:&lt;/p>
&lt;p>dotnet new gitignore&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_890wNaAHuUov2HuWgO-GMA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_MZv9nGPc9QVfguqERWvPHg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;ol>
&lt;li>Inicializando nosso repositório e adicionando todos os nossos arquivos para a área de staging.&lt;/li>
&lt;/ol>
&lt;p>git init&lt;/p>
&lt;p>&lt;code>ash git add . git status &lt;/code>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_3pibD-rKZP1PS1xljNecaQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_cRNA_rHAGGtS7UaFS_no9g.png"
loading="lazy"
alt="Image"
>
Realizando commit das alterações&lt;/p>
&lt;p>git commit -m &amp;ldquo;commit inicial&amp;rdquo;&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_HVKSn9IVa6DSs-r3BaU0Sw.png"
loading="lazy"
alt="Image"
>
Até agora todas as operações que realizamos foram locais. Para enviarmos o código para o GitHub, primeiro precisamos criar um repositório. Acesse sua conta no GitHub e siga os passos abaixo:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_HIljyNTqWb0jVrH3qQrgfg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_K4JZxUpaEpX6datV035Taw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Como já temos um repositório criado, copie o código da opção abaixo, cole e execute no terminal:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_t746pMFDe4DWlKE1faIoGQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>git remote add origin &lt;a class="link" href="https://github.com/wesleycamargo/Pipeline-CICD.git" target="_blank" rel="noopener"
>https://github.com/wesleycamargo/Pipeline-CICD.git&lt;/a>
git push -u origin master&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_Y3JwSEl19oSZZ-lM3OvteA.png"
loading="lazy"
alt="Image"
>
Ao atualizar a página do repositório nosso código já estará lá&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_5efmdYAQl8YQiFN28POzoA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="criando-action-deci">Criando Action de CI
&lt;/h3>&lt;p>Na tela anterior clique em Actions, o GitHub deverá identificar que o código da aplicação foi escrito em .NET Core e irá sugerir um template de workflow. Pode selecioná-lo:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_ywXMxJH3-1_g0QjONb_dRg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Na tela seguinte será apresentado um arquivo .yml. Nesse momento vamos mante-lo assim, realizando o commit na branch master:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_knrDZXqVK36ev1z3G0tZNQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_4gjYy7uBYpbqgLzEyz1q7Q.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Será criada uma pasta .github/workflows no seu repositório, nela será adicionado um arquivo com o conteúdo abaixo:&lt;/p>
&lt;p>Agora você será redirecionado para a parte de código. Clique novamente em Actions e você irá notar que foi criado um workflow e ele já foi iniciado automaticamente. Clique no evento que foi acionado e no build conforme as imagens:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_dz7AYBXgKaNs4oFZNTcjlA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_3U66s-lKGpwX3IhBfTWk4g.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Observe que é possível visualizar o log da execução do build.&lt;/p>
&lt;p>Já temos um build realizando a Continuous Integration(CI) de nossa aplicação.&lt;/p>
&lt;h3 id="adicionando-azure-web-app-publish-profile-aogithub">Adicionando Azure Web App Publish Profile ao GitHub
&lt;/h3>&lt;p>Vá a um Web App já existente no portal do Azure e clique em Get publish profile.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_3majHLs0wenSKihXcJz1_g.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Será realizado o download de um arquivo com a extensão .PublishSettings. Copie o conteúdo dele.&lt;/p>
&lt;p>No GitHub, vá às configurações para adicionar como Secret:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_NcJ8M45gPkf_Gri9_b6xCA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Nomeie como AZURE_WEBAPP_PUBLISH_PROFILE e em value adicione o conteúdo do arquivo .PublishSettings&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_4F2kuZv5VPXAyrfKlY5PLA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="publicando-a-aplicação-noazure">Publicando a aplicação no Azure
&lt;/h3>&lt;p>Para configurar o Continuous Delivery(CD) vamos realizar algumas alterações no arquivo yml. Eu acho um pouco difícil editar pela página web, então vou realizar um pull do meu repositório local e editar no VS Code, mas você pode fazer onde for melhor para você =).&lt;/p>
&lt;p>Primeiro vamos substituir o código anterior por um código mais enxuto e com uma nova função: *publish. *Vamos adicionar também uma task para realizar o upload dos artefatos gerados:&lt;/p>
&lt;p>Aqui também adicionamos variáveis de ambiente para nossa aplicação. Altere os valores de WebApp_Name e DotNet_Version para os valores de acordo com seu ambiente:&lt;/p>
&lt;p>env:
AZURE_WEBAPP_NAME: webAppAction-wes
AZURE_WEBAPP_PACKAGE_PATH: &amp;lsquo;.&amp;rsquo;
DOTNET_VERSION: &amp;lsquo;3.1.201&amp;rsquo;Com a task para realizar o upload dos artefatos, podemos notar que após executar o build podemos baixá-los:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_8yVX7O0LWDqV-I0JkRPl_w.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Ao final sua aplicação estará publicada em seu WebApp:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/criando-um-pipeline-de-cicd-usando-github-actions/1_qNyToH28zHlXZfy3uUravA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Vou deixar aqui o link do repositório caso queiram visualizar: &lt;a class="link" href="https://github.com/wesleycamargo/Pipeline-CICD" target="_blank" rel="noopener"
>https://github.com/wesleycamargo/Pipeline-CICD&lt;/a>&lt;/p>
&lt;p>Valeu!&lt;/p></description></item><item><title>O que é Automação de Configuração e por que devo utilizar</title><link>http://www.wesleycamargo.com/p/o-que-%C3%A9-automa%C3%A7%C3%A3o-de-configura%C3%A7%C3%A3o-e-por-que-devo-utilizar/</link><pubDate>Sat, 25 Apr 2020 23:14:58 +0200</pubDate><guid>http://www.wesleycamargo.com/p/o-que-%C3%A9-automa%C3%A7%C3%A3o-de-configura%C3%A7%C3%A3o-e-por-que-devo-utilizar/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/o-que-automaao-de-configuraao-e-por-que-devo-utilizar/1_9pQikZFibQWVP6-zugbKWg.png" alt="Featured image of post O que é Automação de Configuração e por que devo utilizar" />&lt;h3 id="o-que-é-automação-de-configuração-e-por-que-devoutilizar">O que é Automação de Configuração e por que devo utilizar
&lt;/h3>&lt;h4 id="se-acidentalmente-alguém-destruir-seu-ambiente-de-produção-agora-quanto-tempo-você-gastaria-para-deixar-tudo-funcionando-novamente">Se acidentalmente alguém destruir seu ambiente de produção agora, quanto tempo você gastaria para deixar tudo funcionando novamente?
&lt;/h4>&lt;p>Automação de configuração ou Continuous Configuration Automation (CCA) é um tipo de ferramenta de IaC que após o provisionamento dos recursos irão garantir que todas as configurações necessárias para que a aplicação funcione estão instaladas e configuradas corretamente no nosso ambiente.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/o-que-automaao-de-configuraao-e-por-que-devo-utilizar/1_9pQikZFibQWVP6-zugbKWg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>No mundo de DevOps é muito comum ouvirmos falar sobre Infraestrutura como código (IaC), que nada mais é que provisionar a infraestrutura de nossas aplicações através de arquivos que são tratados da mesma forma que o código fonte.&lt;/p>
&lt;p>Basicamente Infra as Code possui 2 tipos de ferramentas:&lt;/p>
&lt;ul>
&lt;li>**Provisionamento de recursos **- nessa categoria estão ferramentas que criam os recursos de infraestrutura que serão utilizados por nossas aplicações. 
Entre as ferramentas mais conhecidas estão: &lt;strong>AWS Cloud Formation&lt;/strong>, &lt;strong>ARM Templates&lt;/strong> e talvez a mais conhecida de todos, o &lt;strong>Terraform&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>Continuous Configuration Automation (CCA) ou Configuração de ambientes&lt;/strong> - aqui estão ferramentas, como mencionado acima, que após a criação dos recursos irão garantir que todas as configurações necessárias para que a aplicação funcionem estejam de acordo com o especificado. Exemplos dessas configurações são, garantir que portas de firewall estejam liberadas, outros softwares que minha aplicação tenha dependência estejam instalados, servidores de aplicação onde minha aplicação irá rodar esteja com a versão correta do framework utilizado, permissões de acesso, entre todas as outras configurações necessárias para nosso ambiente.
Aqui estão alguns exemplos dessas ferramentas: &lt;strong>Chef&lt;/strong>, &lt;strong>Puppet&lt;/strong>, &lt;strong>Powershell DSC&lt;/strong>, &lt;strong>Ansible&lt;/strong> entre vários outros. Aqui neste artigo demonstro a utilização básica do &lt;a class="link" href="https://medium.com/@camargo.wes/criando-um-dsc-b%C3%A1sico-9b0a694b8e12" target="_blank" rel="noopener"
>Powershell DSC&lt;/a>.&lt;/li>
&lt;/ul>
&lt;p>Em algumas ferramentas é possível realizar as duas tarefas sendo assim você pode utilizar apenas uma, porém, sempre haverá especialização em uma das duas categorias (provisionamento ou configuração), o que pode dar um pouco mais de trabalho para a implementação na categoria menos especializada. Nesse caso deve ser avaliado o custo benefício de implementação vs valores gastos com licenças, por exemplo.&lt;/p>
&lt;h3 id="mas-por-que-eu-precisodisso">Mas por que eu preciso disso?
&lt;/h3>&lt;p>Acredito que hoje, 99% das as empresas devem utilizar algum tipo de controle de versão para manter seu software (se não está utilizando é melhor pensar nisso imediatamente!), entretanto, em grande parte esses sistemas são utilizados apenas para versionamento de código fonte, quando deveria englobar todos os artefatos necessários para recriar seus binários e ambientes.&lt;/p>
&lt;h4 id="criar-o-ambiente-da-aplicação-à-qualquermomento">&lt;strong>Criar o ambiente da aplicação à qualquer momento&lt;/strong>
&lt;/h4>&lt;p>Para que em uma emergência seja possível recriar nosso ambiente com o mínimo de esforço, um dos princípios de DevOps é que devemos manter absolutamente &lt;strong>TUDO&lt;/strong> que seja necessário para criarmos uma versão de nossa aplicação do zero em um sistema de &lt;strong>Controle de Versão&lt;/strong>&lt;/p>
&lt;p>Eu já presenciei essa experiência por duas vezes (não foi minha culpa heheh), e em ambas boa parte dos recursos estavam sim versionados, mas alguns como configurações de aplicação, regras de DNS, e alguns outros itens infelizmente não. A maior parte foi configurada razoavelmente rápido, mas por algumas semanas fomos descobrindo alguns itens de configuração que faltavam ou estavam incorretos.&lt;/p>
&lt;h4 id="ambientes-de-desenvolvimentos-padronizados">Ambientes de desenvolvimentos padronizados
&lt;/h4>&lt;p>Acredito que todos na área de TI já ouviram a famosa frase &lt;strong>“Na minha máquina funciona”&lt;/strong>.&lt;/p>
&lt;p>Outra vantagem será garantir que &lt;strong>todos os desenvolvedores utilizam um ambiente idêntico&lt;/strong>, com todas as dependências instaladas e configurações realizadas. Caso isso não seja implementado, poderá causar problemas como por exemplo, desenvolvedores utilizando versões diferentes de um framework, e ao juntar suas alterações ocorrerem conflitos que precisarão ser corrigidos, ou até mesmo alguma dependência de software que existe apenas no ambiente do desenvolvedor.&lt;/p>
&lt;h4 id="controle-das-alterações-realizadas-nos-ambientes">Controle das alterações realizadas nos ambientes
&lt;/h4>&lt;p>Com o versionamento das definições de configurações dos ambientes em arquivos armazenados em um **Sistemas de Controle de Versão **todas as alterações podem ser iniciadas através de alterações nos arquivos e enviadas ao SCV, o que nos fornece um &lt;strong>registro de todas as mudanças realizadas no ambiente&lt;/strong> e remove a necessidade de acessar algum servidor para realizar alterações, já que todo o processo será realizado de forma automática, garantindo padronização dos ambientes.&lt;/p></description></item><item><title>Criando um DSC básico</title><link>http://www.wesleycamargo.com/p/criando-um-dsc-b%C3%A1sico/</link><pubDate>Fri, 24 Apr 2020 22:54:25 +0200</pubDate><guid>http://www.wesleycamargo.com/p/criando-um-dsc-b%C3%A1sico/</guid><description>&lt;h3 id="continuous-configuration-automation-criando-um-arquivo-dscbásico">Continuous Configuration Automation— Criando um arquivo DSC básico
&lt;/h3>&lt;p>Estou apoiando na implementação de Powershell DSC em um cliente, e sempre preciso de alguma referência para executar algumas operações.&lt;/p>
&lt;p>Nesse primeiro post está um arquivo bem básico para ser utilizado como referência:&lt;/p></description></item><item><title>DevOps substitui os métodos Ágeis - Mitos de DevOps</title><link>http://www.wesleycamargo.com/p/devops-substitui-os-m%C3%A9todos-%C3%A1geis-mitos-de-devops/</link><pubDate>Sun, 22 Mar 2020 17:29:00 +0100</pubDate><guid>http://www.wesleycamargo.com/p/devops-substitui-os-m%C3%A9todos-%C3%A1geis-mitos-de-devops/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/devops-substitui-os-mtodos-geis-mitos-de-devops/0_b2a6QQ43p1DsN-jz.png" alt="Featured image of post DevOps substitui os métodos Ágeis - Mitos de DevOps" />&lt;h3 id="devops-substitui-os-métodos-ágeis---mitos-dedevops">DevOps substitui os métodos Ágeis - Mitos de DevOps
&lt;/h3>&lt;p>Tanto DevOps quanto desenvolvimento ágil se aplicam ao desenvolvimento de software visando melhorar a qualidade e velocidade de entrega de software, ou valor, para o usuário final, apesar disso, possuem maneiras de atuação diferentes.&lt;/p>
&lt;p>Todo mundo que trabalha na área de TI já deve ter ouvido sobre o famoso manifesto ágil. De maneira resumida, nos início dos anos 2000, um grupo de desenvolvedores se reuniu em Utah nos Estados Unidos, cada um já adotando algum método de desenvolvimento, mas em comum todos esses métodos compartilhavam dos mesmos fundamentos.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/devops-substitui-os-mtodos-geis-mitos-de-devops/0_b2a6QQ43p1DsN-jz.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Na minha opinião, a melhor definição de DevOps é uma cultura que combina &lt;strong>ferramentas&lt;/strong>, &lt;strong>pessoas&lt;/strong> e &lt;strong>processos&lt;/strong>, para aumentar a velocidade de entrega de valor, não necessáriamente software, para o cliente. Enquanto Ágil é considerado uma metodologia de desenvolvimento onde devemos ter feedback o mais cedo possível para que possamos melhorar continuamente, portanto, poderia se enquadrar como parte do &lt;strong>processo&lt;/strong> de DevOps.&lt;/p>
&lt;p>É muito comum vermos nas empresas a combinação de ambos para que alcancem seus objetivos, pois eles se complementam. Isso pode ser feito com uma combinação de desenvolvimento ágil com outras práticas como versionamento de código, automação de build e releases, aprovações de releases automatizadas, etc (apesar de DevOps não ser apenas automação, já falei sobre isso &lt;a class="link" href="https://medium.com/@camargo.wes/devops-%C3%A9-automa%C3%A7%C3%A3o-mitos-de-devops-5063e0aa8ff9" target="_blank" rel="noopener"
>nesse artigo&lt;/a>). Inclusive as práticas de DevOps ajudam a fornecer esse feedback rápido para o desenvolvedor, como a utilização de validações de integração de código com builds automatizadas, por exemplo.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/devops-substitui-os-mtodos-geis-mitos-de-devops/1_jIeajBIHkQlA2OHiCFZMzw.jpeg"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h4 id="mas-não-consigo-realizar-as-entregas-só-comágil">Mas não consigo realizar as entregas só com ágil?
&lt;/h4>&lt;p>Um dos princípios do manifesto ágil, é a entrega de software potencialmente “entregável”. Mas potencialmente entregável, não quer dizer implantado em produção… 🤔&lt;/p>
&lt;p>A utilização de DevOps seria o complemento para que o valor gerado pelo desenvolvimento ágil chegue até o usuário final de uma maneira mais rápida e confiável, promovendo a integração das equipes, pois se as boas práticas forem seguidas, seu software já pode ser publicado em um ambiente real desde o início, evitando surpresas e retrabalhos ao final de uma iteração. Pode até mesmo ser considerado o fim da famosa frase “Na minha máquina funciona!”&lt;/p></description></item><item><title>DevOps é Automação - Mitos de DevOps</title><link>http://www.wesleycamargo.com/p/devops-%C3%A9-automa%C3%A7%C3%A3o-mitos-de-devops/</link><pubDate>Fri, 20 Mar 2020 03:32:22 +0100</pubDate><guid>http://www.wesleycamargo.com/p/devops-%C3%A9-automa%C3%A7%C3%A3o-mitos-de-devops/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/devops-automaao-mitos-de-devops/1_EI0H1iSfOK-JoTJJc5cE1w.png" alt="Featured image of post DevOps é Automação - Mitos de DevOps" />&lt;h3 id="devops-é-automação---mitos-dedevops">DevOps é Automação - Mitos de DevOps
&lt;/h3>&lt;p>Existem muitos benefícios de realizar as automações das etapas de nosso processo, como por exemplo, a redução do tempo de implantação uma release de 1 hora para 5 minutos. Conseguimos &lt;strong>economizar 55 minutos de tempo de deploy!&lt;/strong>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/devops-automaao-mitos-de-devops/1_EI0H1iSfOK-JoTJJc5cE1w.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Mas pode ser que seu processo tenha um gargalo e seu software fique &lt;strong>1 semana aguardando uma aprovação&lt;/strong>.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/devops-automaao-mitos-de-devops/1_wpk0Cna1maqtuK4Q5e0s_w.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Infelizmente, esses 55 minutos economizados, &lt;strong>se tornam praticamente irrelevantes se comparados à 1 semana aguardando aprovação&lt;/strong>. Seria mais eficiente entender o motivo de uma aprovação demorar dias ou semanas e então trabalhar para reduzir esse tempo.&lt;/p>
&lt;p>No livro “DevOps Handbook”, os autores chegam a uma conclusão em que sou obrigado a concordar com eles: Uma quantidade significativa dos problemas das empresas são os mesmos, e as soluções provavelmente também são as mesmas!&lt;/p>
&lt;p>Mas se as soluções para os problemas são conhecidos, por que não as utilizamos?&lt;/p>
&lt;p>Nessa série de artigos baseados no livro, irei descrever alguns mitos que fazem com que essas soluções sejam ignoradas, e os problemas continuem lá, esperando para serem resolvidos.&lt;/p>
&lt;h3 id="devops-é-apenas-automação">DevOps é apenas Automação?
&lt;/h3>&lt;p>Quem nunca ouviu em alguma empresa ou cliente as pessoas dizerem: “Temos DevOps, fazemos todo o deploy de nosso sistemas de forma automática!” ?&lt;/p>
&lt;p>É verdade que muitas práticas e padrões utilizados na cultura DevOps possuem sim processos de automação. Entre eles os mais comuns são Build, Deploy e Testes.&lt;/p>
&lt;p>Entretanto, DevOps vai muito além disso! Para conseguirmos implantar o conjunto de práticas de maneira eficiente devemos considerar entre outros, os itens descritos nesse post: &lt;a class="link" href="https://medium.com/@camargo.wes/o-que-%C3%A9-devops-56f9a7ece1f5" target="_blank" rel="noopener"
>O que é DevOps?&lt;/a>&lt;/p>
&lt;h4 id="então-não-devo-automatizar">Então não devo automatizar?
&lt;/h4>&lt;p>Sim, &lt;strong>você deve&lt;/strong> continuar automatizando tudo que for possível dentro do seu processo: build, release, testes, ambientes, pipelines, porém não deve considerar apenas isso como DevOps.&lt;/p>
&lt;p>Espero ter conseguido dar uma perspectiva um pouco diferente para que todos que tinham essa visão de que DevOps é apenas Automação, consigam explorar todo esse universo.&lt;/p>
&lt;p>Até a próxima!&lt;/p>
&lt;p>Referencias:&lt;/p>
&lt;p>&lt;a class="link" href="https://www.amazon.com.br/DevOps-Handbook-World-Class-Reliability-Organizations-ebook/dp/B01M9ASFQ3/ref=sr_1_2?adgrpid=61528803804&amp;amp;gclid=CjwKCAjwsMzzBRACEiwAx4lLG0XDW0RBvc710sIXI80OfSxf6_mkBhZn7MW-SQP5fUkNnnEY0pWj1xoCGDUQAvD_BwE&amp;amp;hvadid=326935150244&amp;amp;hvdev=c&amp;amp;hvlocphy=1001773&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=12684604304342698395&amp;amp;hvtargid=kwd-465145704369&amp;amp;hydadcr=5626_10696887&amp;amp;keywords=manual&amp;#43;de&amp;#43;devops&amp;amp;qid=1584669906&amp;amp;sr=8-2" target="_blank" rel="noopener"
>DevOps Handbook&lt;/a>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/devops-automaao-mitos-de-devops/0_YOTWkzlSypfHqo09.jpg"
loading="lazy"
alt="Image"
>&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>Conectando WebApps a redes existentes</title><link>http://www.wesleycamargo.com/p/conectando-webapps-a-redes-existentes/</link><pubDate>Sun, 05 Aug 2018 00:38:24 +0200</pubDate><guid>http://www.wesleycamargo.com/p/conectando-webapps-a-redes-existentes/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_ooxS-JBEtmGsvRK8CnOofQ.png" alt="Featured image of post Conectando WebApps a redes existentes" />&lt;h3 id="conectando-webapps-a-redes-existentes">Conectando WebApps a redes existentes
&lt;/h3>&lt;p>Em algumas situações quando utilizamos WebApps pode ser necessária a comunicação com algum recurso já existente em nossa rede, como por exemplo um banco de dados IaaS, uma API, ou até mesmo um outro WebApp.&lt;/p>
&lt;p>A maneira mais simples de realizar essa comunicação é através da internet, mas, apesar de ser mais fácil isso pode expor sua aplicação a vários riscos de segurança, como invasões, roubos de dados, etc.&lt;/p>
&lt;p>Para solucionar esse problema, o Microsoft Azure possui um recurso chamado VNet Integration, que permite a conexão de um WebApp a uma rede existente.&lt;/p>
&lt;p>Agora irei demonstrar como realizar a conexão:&lt;/p>
&lt;h3 id="criando-a-virtual-networkvnet">Criando a Virtual Network (VNet)
&lt;/h3>&lt;p>Se você já possuir uma VNet pode pular para a próxima etapa. Para a criação não existem muitos segredos, a VNet pode seguir as configurações padrão sugeridas:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_ooxS-JBEtmGsvRK8CnOofQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Após a criação da VNet, precisamos criar um VNet Gateway, que será utilizado para realizar uma conexão VPN Point to Site (P2S) do seu WebApp para a sua VNet, para isso é necessário adicionar uma subnet exclusiva para gateways. Vá em “Subnets” e clique em “Gateway subnet”:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_7g8AWHV9rkU0BHSXzeUylw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Repare que a subnet é nomeada automaticamente, isso acontece pois no momento da criação do VNet Gateway ele irá buscar por esse nome:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_VVxUnVXtCI7GtggN4N7tGw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_iEBQdhcwJHe9fHv6fQ7RHw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Com a subnet criada, vamos à criação do Gateway.&lt;/p>
&lt;h3 id="criando-o-virtual-networkgateway">Criando o Virtual Network Gateway
&lt;/h3>&lt;p>Em Gateway type selecione “VPN”, em VPN type “Route-based” e em Virtual network, escolha a VNet criada:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_OHq0fdZ5KgQz9u_uyw5Egg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Essa etapa pode ser um pouco demorada, no geral demora em torno de 30 minutos para a criação do gateway.&lt;/p>
&lt;p>Após criado vá em Point-to-site configuration, desabilite a opção IkeV2, e adicione a chave de um certificado do tipo CER. Este certificado será baixado automaticamente pelo WebApp para realizar a autenticação na VPN.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_qW_53OBwgcWL5X8-LnYeWA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Ao realizar a configuração do WebApp para a conexão do Gateway, você poderá receber a mensagem de erro abaixo dizendo que o protocolo IkeV2 não é compatível, certifique-se que a opção está desabilitada conforme a imagem acima.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_sFY7BaCwYIsmSA2p8p5sDQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;h3 id="conectando-owebapp">Conectando o WebApp
&lt;/h3>&lt;p>Assim como a VNet, caso já possua o WebApp vá para o próximo passo. Caso ainda não tenha, pode manter as configurações padrão.&lt;/p>
&lt;p>Vá em networking e em VNet Integration clique em Setup, e depois escolha a VNet que possui o VNet Gateway:&lt;/p>
&lt;h3 id="problemas-comuns">Problemas comuns
&lt;/h3>&lt;p>Outro problema muito comum, é o certificado estar fora de sincronia:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_1rF5SbrpU3k9CumNYthJog.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Para resolver isso, vá ao Service Plan do seu WebApp, e force o sincronismo:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_iKviBxXJs-5p_JRs0layHw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_WjGMewg60baKDTdT2CbVsw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Após esses passos seu WebApp será capaz de acessar os recursos da sua rede!&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/conectando-webapps-a-redes-existentes/1_vatVLsT-KnKJyuxXyfkHHQ.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Abraço!&lt;/p>
&lt;p>&lt;em>Originally published at &lt;em>&lt;a class="link" href="http://wesleycamargo.com.br/2018/08/04/conectando-webapps-a-redes-existentes/" target="_blank" rel="noopener"
>&lt;em>wesleycamargo.com.br&lt;/em>&lt;/a>&lt;/em> on August 18, 2018.&lt;/em>&lt;/p></description></item><item><title>Transformando configurações de XML e JSON com Web Apps</title><link>http://www.wesleycamargo.com/p/transformando-configura%C3%A7%C3%B5es-de-xml-e-json-com-web-apps/</link><pubDate>Sat, 31 Mar 2018 02:05:53 +0200</pubDate><guid>http://www.wesleycamargo.com/p/transformando-configura%C3%A7%C3%B5es-de-xml-e-json-com-web-apps/</guid><description>&lt;img src="http://www.wesleycamargo.com/img/transformando-configuraes-de-xml-e-json-com-web-apps/1_BD0EV8VzKpc9o7qG8R9XLg.png" alt="Featured image of post Transformando configurações de XML e JSON com Web Apps" />&lt;h3 id="transformando-configurações-de-xml-e-json-com-webapps">Transformando configurações de XML e JSON com Web Apps
&lt;/h3>&lt;p>Em um post anterior demonstrei como gerenciar configurações utilizando Azure Key Vault (&lt;a class="link" href="https://medium.com/@camargo.wes/gerenciando-transformacoes-de-configuracao-com-azure-key-vault-e-vsts-434bc1b26cd8" target="_blank" rel="noopener"
>clique aqui &lt;/a>para ver). 
Agora irei mostrar como podemos realizar a transformação de uma configuração utilizando as tasks de deploy de Web Apps de uma maneira simples e fácil.&lt;/p>
&lt;p>&lt;strong>Configurando meu Web App&lt;/strong>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/transformando-configuraes-de-xml-e-json-com-web-apps/1_BD0EV8VzKpc9o7qG8R9XLg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Para a utilização do recurso, crie um release definition e adicione uma task de Web App.&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/transformando-configuraes-de-xml-e-json-com-web-apps/1_cfAK7r-6h5b_VROzPp8g2Q.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Na sessão “File Transforms &amp;amp; Variable Substitution Options” selecione “XML Variable Substitution”. Caso tenha arquivos .json que precisem ser alterados, especifique o caminho dos arquivos:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/transformando-configuraes-de-xml-e-json-com-web-apps/1_cOXb7wzeKEAze9sSg6SKGw.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Neste exemplo, irei alterar a uma chave de configuração no arquivo web.config:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/transformando-configuraes-de-xml-e-json-com-web-apps/1_K26WD3Zy6VaAQRXXratqUA.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Adicione uma variável com o mesmo nome da key, neste caso “configuracao”, e o valor desejado da substituição:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/transformando-configuraes-de-xml-e-json-com-web-apps/1_Flc2Aaxh0kXA-O4SxCZhWg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>No caso de arquivos json, deverá ser especificado o nó no nome da chave:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/transformando-configuraes-de-xml-e-json-com-web-apps/1_iBdcONMNd2DOZlqLuu3rRg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/transformando-configuraes-de-xml-e-json-com-web-apps/1_e2FURP_OrQ-rMBar00W-Yg.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>E após estes simples procedimentos basta salvar a release definition e iniciar um novo deploy e a transformação será realizada. Neste exemplo, a aplicação foi publicada em um Web App e o valor definido na variável foi transformado:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/transformando-configuraes-de-xml-e-json-com-web-apps/1_a3g9L863Z2UvFFbFGJ1K-g.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>Abaixo está um tooltip da própria task explicando em quais situações será possível utilizar este recurso:&lt;/p>
&lt;p>&lt;img src="http://www.wesleycamargo.com/img/transformando-configuraes-de-xml-e-json-com-web-apps/1_TVK15wPOvrDrHIQM7GDc7Q.png"
loading="lazy"
alt="Image"
>&lt;/p>
&lt;p>&lt;strong>Conclusão&lt;/strong>&lt;/p>
&lt;p>Antes da existência deste recurso, ou no caso de publicações que não utilizam WebApps, era necessário gerar um arquivo web.release.config, e alterar o valor para um token.&lt;/p>
&lt;p>Com este novo processo, esta etapa não é mais necessária, onde precisamos apenas adicionar uma variável com o mesmo nome da key, e a task irá substituir os valores automaticamente.&lt;/p>
&lt;p>Com isso o processo de gestão das configurações se torna muito mais rápido e eficiente!&lt;/p>
&lt;p>Abraço!&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>