banner



How To Deploy An Arm Template

Agenda

  • Introduction
  • Terms
  • Infrastructure
  • Event
  • Solution
  • Prerequisites
  • Requirements
  • How to run
  • What's next
  • Build
  • Release
  • Conclusions
  • Links

Introduction

Recently I was working on an internal tool for automated task commitment between functional departments of our company.

And today I would like to share with you my experience of encountering a certain event and the way I dealt with it, only firstly, it should be mentioned I've never faced with such task for my ain, cause I'm not a DevOps engineer. Only information technology was fun! 😁

Terms

Before we start, I suppose we need to sync up our terms to exist on the aforementioned page.

Azure — a cloud platform adult and maintained by Microsoft provides SaaS, IaaS, and PaaS and supports many different programming languages, tools, and frameworks (wiki).

Resources — ways whatever type of PaaS or IaaS resource provided past Azure. Tin can exist a VM, some Storage, Network component, Service Bus, Analytics and Security stuff and so on.

ARM template (Azure Resource Manager) — just a template to describe Azure Resources Group construction, resources and their dependencies.

Azure DevOps (ex TFS) — an environment for projection management, reporting, concurrently VCS, CI/CD tool.

App Service — a logical container to setup, deploy and scale your application on. See more than hither.

Azure Function — a tiny piece of code to handle events in a server-less manner. Encounter more here.

Artifact — your code compiled and packed with all dependencies and is ready to deploy. See more here.

Pipeline — just the steps to be configured to perform build or release or deploy process. Come across more here.

Azure KeyVault — a key-undercover store. See more hither.

Infrastructure

An application nosotros were working on consisted of Bot service with Skype channel, MVC Spider web App, Azure Function, MySQL database, Azure KeyVault.

How it is connected to each other yous can run into on the following effigy:

The infrastructure of the awarding
  1. Triggered Azure Function makes a call to API
  2. API calls Jira API to get some data
  3. API gets a response
  4. API pushes it to Bot
  5. Bot pushes to particular Skype aqueduct
  6. Bot notifies API about completion

Additionally UI on Angular can interact with API to practice some management stuff.

Issue

At that place was a need to setup a Test environment. And I wanted to brand it in DevOps fashion but had no such hands-on feel and even theoretical footing. Then, I spent some time on the investigation to immerse into that and got some results I want to share with you.

Solution

Export template of an already existing surroundings

A solution constitute was ARM template rewritten based on exported Staging environs template (as you can see at the picture). If you are super lucky, Azure will requite less messy template file, cause actually, it gives you a template full of default values (such every bit null, empty string, 0, false) which y'all can remove I suppose.

Anyway if you lot have no equivalent environment, you tin download ARM templates here and fill up them up and gather with Visual Studio Code and ARM template extension.

Ordinarily, the structure of ARM template looks in the following way or you can meet my full example here:

Prerequisites

If your PowerShell is not capable to run scripts, you need to run the following command:

          Gear up-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Featherbed        

A possible issue is the absenteeism of AzureRM module for PowerShell:

          Install-Module -Proper noun AzureRM        

Requirements

You have to set the same value for $resourceGroupName in deploy.ps1 and appName in parameters.json → parameters.

HOW TO RUN

          .\deploy.ps1 -subscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -ResourceGroupName <AppGroupName> -resourceGroupLocation <Location> -chatbotName <BotName> -deploymentName <DeploymentName>        

How it works:

  • deploy.ps1 — Creates a new ResourceGroup in Azure nether your subscription.
  • template.json — ARM template describes what resources have to be deployed. Resource described include Bot Channels Registration, App Service, App Service plan, Storage account, Function, App Service plan for Function, Key Vault.
  • parameters.json — All the parameters needed to brand the template easy to maintain.

List of parameters in deploy.ps1:

  • subscriptionId — Guid of your Azure subscription
  • resourceGroupName — a name for Resource Group to create
  • resourceGroupLocation — a location that volition be used for the group location and all the resources likewise
  • deploymentName — a name of deployment that volition exist shown in the deployment section on Azure portal
  • templateFilePath — path to ARM template
  • parametersFilePath — path to parameters file for the template
  • chatbotName — a name of the bot

List of resources in template.json:

  • Microsoft.KeyVault/vaults
  • Microsoft.Storage/storageAccounts
  • Microsoft.Spider web/serverfarms (for App Service)
  • Microsoft.Spider web/serverfarms (for Part)
  • Microsoft.Web/sites (App Service)
  • Microsoft.Web/sites (Function)
  • Microsoft.Web/sites/config (for App Service)
  • Microsoft.Web/sites/hostNameBindings (for App Service)
  • Microsoft.Web/sites/config (for Part)
  • Microsoft.Web/sites/hostNameBindings (for Function)

Meet an error from Azure by correlationId:

          Get-AzureRMLog -CorrelationId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -DetailedOutput        

What'south adjacent

Next footstep to make is setup build and release pipelines somewhere you take CI/CD and VCS. In our instance that was Azure DevOps.

Build

The build was implemented with Azure DevOps builds and very simple azure-pipeline.yml

Release

Past that date, Azure DevOps didn't support YAML configuration for Release and Deploy so I was forced to do it via UI past clicking some buttons.

Release pipeline in Azure DevOps

Fortunately, it is easy to practice. All you need to do is just:

  • click New — New release pipeline
  • select a template for a job

  • configure the artifacts by selecting an advisable build pipeline and needed versioning
  • configure a phase to set subscription and awarding proper name on Azure
  • specify Agent job parameters
  • bind the artifacts to download by created job
  • tune some parameters on Azure App Service Deploy if needed

Conclusions

During the time I've been busy with setting Test surroundings up I've concluded up with several points regarding work with Azure in two lists of upsides and downsides.

Downsides:

  • Microsoft documentation covers only the easiest scenarios ('hello earth' blazon examples)
  • Each of the resources has different validation rules which are found out only from deployment to deployment or looking through the schema of the template.
  • Looks like some part of the whole Azure can behave unstably or even not work at all. The overall system sometimes looks raw (for example I wasn't able to update an icon for Bot via Azure CLI, Deployment Centre on Azure cannot load data and throws an error in the console if no deployment is setup).
  • I haven't found any other way to write YAML config for Azure DevOps except a browser that'due south but one place where IntelliSense is provided.
  • Azure DevOps doesn't have an ability to configure release and deploy with YAML files.

Upsides:

  • It is possible to deploy an environment with ARM template in contrast to preferred UI-oriented arroyo.
  • ARM template is flexible enough to build more or less regular or even advanced application on Azure.
  • Azure CLI and AzureRM module are pretty skilful and mature to build your own toolset on top of these 2 guys to make all your DevOps processes convenient.

Links

Sample projection on GitHub

Azure Pipelines doctor

Azure Resources templates examples

ARM template helper extension for VS Lawmaking

ARM template schema is very useful to bank check to minimize errors during deployment

Follow us on Twitter 🐦 and Facebook 👥 and join our Facebook Group 💬.

To join our community Slack 🗣️ and read our weekly Faun topics 🗞️, click here⬇

If this mail was helpful, please click the clap 👏 push below a few times to show your support for the author! ⬇

How To Deploy An Arm Template,

Source: https://faun.pub/deploy-your-azure-environment-with-arm-template-110e52eeb66

Posted by: andersondadogiag.blogspot.com

0 Response to "How To Deploy An Arm Template"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel