<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://blog.orneling.se/feed.xml" rel="self" type="application/atom+xml" /><link href="https://blog.orneling.se/" rel="alternate" type="text/html" /><updated>2025-06-17T13:35:02+02:00</updated><id>https://blog.orneling.se/feed.xml</id><title type="html">A blog on Microsoft Azure by Daniel Örneling</title><subtitle>A blog about Azure by Daniel Örneling.</subtitle><author><name>Daniel Örneling</name></author><entry><title type="html">A complete makeover</title><link href="https://blog.orneling.se/2021/02/a-complete-makeover" rel="alternate" type="text/html" title="A complete makeover" /><published>2021-02-18T00:00:00+01:00</published><updated>2021-02-18T00:00:00+01:00</updated><id>https://blog.orneling.se/2021/02/a-complete-makeover</id><content type="html" xml:base="https://blog.orneling.se/2021/02/a-complete-makeover"><![CDATA[<p>For those of you that come here frequenty, last few days a lot has happened. First, the looks of of the blog has changed completely from a blue colourful theme into a dark mode theme.
And that´s what the title of this blog post refers to. The blog, not me.</p>

<!--More-->

<p>So whats been changed is that I have moved the blog and rewritten it to be hosted through Github pages with Jekyll instead of WordPress with another hoster.
This happened quite fast in a few days time over the last week when I could find the time, but it´s something ive been wanting to do for a long time.</p>

<h3 id="slow-blog-and-full-of-maintenance"><strong>Slow blog and full of maintenance</strong></h3>
<p>I know some has mentioned this when they´ve done the same move as I´ve done now. Tao Yang for instance mentioned all of the maintenance that comes with WrodPress as a big down-side with it. You can read his blog about it <a href="https://blog.tyang.org/2021/01/04/moved-my-blog-to-github-pages//" target="_blank">here</a> in his blog.
The maintenance part isn´t something I have missed out on, but the opposite. Every time I´ve logged in to the blog´s admin interface there has been 4-5 plugin updates to attend to. That´s boring, takes a lot of time and you never knew if things were gonna fail afterwards or not.</p>

<p>The other two main issues I have had with my current hoster is the amount of outages. I´ve been with the same hoster for about 5 or 6 years now and I lost count of how many times the blog alerted in the middle of the night for an outage lasting everywhere from 5 minutes to 4 hours. All with no previous notice.
That along with the price, around $170 a year for a not so well performing blog got me to finally take the step of moving the blog. GitHub pages is free and you don´t need to pay for any extra SSL certificates, GitHub takes care of that for you and it took about 15 minutes after adding my custom domain before my site were secured and I had my new SSL certificate in place.</p>

<h3 id="the-switch"><strong>The switch</strong></h3>
<p>I saw Tao´s post earlier this year and that got me thinking about making the switch myself. Once I started digging into it, there were some serious time to put into it but most of the time were to just rewrite and make sure the formatting of the posts was correct even on the new blog.
The switch isn´t that complicated once you get a hold of it, I managed to export all my post and have them converted into Markdown which saved me a lot of time in the end. After re-writing the posts, I had some issues getting the <a href="https://mmistakes.github.io/minimal-mistakes" target="_blank">theme</a> up and running but once that was handled I could just focus on publishing the blog and making sure the public DNS records pointed to the new site instead of the old one.</p>

<h3 id="switching-provider-completely"><strong>Switching provider completely</strong></h3>
<p>Since I was about to leave my hoster for GitHub Pages instead, I was thinking about where to keep my domain and the e-mail as well.
In the end I decided to move my domain to GoDaddy since it opened up the opportunity for me to also use my custom domain (Orneling.se) with my Microsoft 365 Family subscription that I use privately.</p>

<h3 id="wrap-up"><strong>Wrap-up</strong></h3>
<p>So, I mentioned I´ve put a lot of time into this move formatting and converting posts and apges, but that doesn’t mean everything will be 100% correct right now. 
If you see any faulty links or missing pictures etc. please leave a comment for me and I´ll try to take care of it as soon as possible.</p>]]></content><author><name>Daniel Örneling</name></author><category term="Makeover" /><category term="New hoster" /><summary type="html"><![CDATA[For those of you that come here frequenty, last few days a lot has happened. First, the looks of of the blog has changed completely from a blue colourful theme into a dark mode theme. And that´s what the title of this blog post refers to. The blog, not me.]]></summary></entry><entry><title type="html">Sponsored: Top 7 challenges with Azure Monitor and how you can fix it.</title><link href="https://blog.orneling.se/2021/02/sponsored-top-7-challenges-with-azure-monitor-and-how-you-can-fix-it" rel="alternate" type="text/html" title="Sponsored: Top 7 challenges with Azure Monitor and how you can fix it." /><published>2021-02-10T00:00:00+01:00</published><updated>2021-02-10T00:00:00+01:00</updated><id>https://blog.orneling.se/2021/02/sponsored-top-7-challenges-with-azure-monitor-and-how-you-can-fix-it</id><content type="html" xml:base="https://blog.orneling.se/2021/02/sponsored-top-7-challenges-with-azure-monitor-and-how-you-can-fix-it"><![CDATA[<p>In the cloud adoption era, organizations urge to deploy their system to a modern cloud for a competitive edge. Microsoft made great strides in providing enterprise-grade to run highly scalable and reliable services. Given that, many Fortune 500 companies like Walmart selected Microsoft Azure as their solution providers.</p>

<p>Applications provisioned on Azure are built on top of architecture that is siloed and highly dynamic. Hence, it is inevitable to monitor the applications and services of Azure to maximise the availability, performance, reliability, and consumption.</p>

<!--More-->

<h3 id="monitoring-azure-resources"><strong>Monitoring Azure Resources</strong></h3>
<p><a href="https://www.serverless360.com/microsoft-azure-monitoring/" target="_blank">Monitoring Azure Resources</a> using the Azure-native tool can be challenging even for the most skilled and experienced person due to its complex and overlap offerings.</p>

<p>If you have tried monitoring in the Azure portal, you might have faced a situation where a tool-A would require monitoring a resource-R. Still, if you want to do another monitoring activity on the same resource-R, you will need to use tool-B. This would undoubtedly lead a user to collect cumbersome of data from disparate sources.
In this blog, we will look at some of the critical challenges users face while monitoring Azure resources using <a href="https://www.serverless360.com/microsoft-azure-monitoring/" target="_blank">Azure Monitor</a> and how to overcome it.</p>

<h3 id="significant-azure-monitoring-challenges"><strong>Significant Azure Monitoring challenges</strong></h3>
<p>Azure application monitoring poses a long list of challenges that users must overcome to achieve better performance and efficiency.</p>

<h3 id="lack-of-application-levelholistic-monitoring"><strong>Lack of Application-level/holistic monitoring</strong></h3>
<p>When examining typical Azure architecture’s anatomy, every application is designed with a combination of multiple siloed Azure resources like Service Bus, Azure Functions, and Virtual Machines across the stack. When the user intends to monitor in the business application context, it is impossible to do so.</p>

<p>Azure Monitor is restricted to monitor individual Azure resources, and users must move between different components to achieve visibility on them.</p>

<h3 id="no-consolidated-report"><strong>No Consolidated Report</strong></h3>
<p>It is not possible to generate a consolidated health, performance, or availability report of all the resources that participate in the Azure applications.</p>

<p>It would be challenging to correlate the reports on every resource from the Azure monitor.</p>

<h3 id="limitations-of-alert-rule"><strong>Limitations of Alert Rule</strong></h3>
<p>In Azure Monitor, adding conditions to an alert rule comes with a considerable challenge where the users can apply only two conditions per rule. The ideal cost for adding those conditions would be $0.20. And hence, if you want to have more conditions, the only option available is to increase the number of alerts which would not be economical.</p>

<h3 id="unable-to-monitor-resources-properties-and-status"><strong>Unable to Monitor Resources Properties and Status</strong></h3>
<p>Business needs would demand monitoring solution way beyond resources metrics, like status and properties of the resources and detect failures in orchestrations.</p>

<p>There is no way you can monitor the resource properties like Dead Lettered Message count in Service Bus Queue/Topic Subscription, Incoming messages to an Event Hub partition.</p>

<p>You can also monitor the status of the resources that may go down due to various reasons like component failure, server failure, or a faulty data centre network switch, rather than disasters like floods or earthquakes.</p>

<h3 id="lack-of-auto-healing-capability"><strong>Lack of Auto-healing capability</strong></h3>
<p>As we have seen above, there are quite significant reasons why a resource may go unavailable in different scenarios, and hence they turn to a disabled state. It is significant to ensure that mission-critical resources are always up and running despite unplanned outages and potential errors.</p>

<p>At a bare minimum, we should bring back the resources state to “Enable” (expected state) as soon as the issues get fixed at solution providers back end.</p>

<h3 id="limited-data-visualisation"><strong>Limited data visualisation</strong></h3>
<p>While Azure Monitor provides some pre-built dashboards, specifically for metrics, users might find themselves somewhat limited to how much they can customise the data displayed using in-built capabilities like Azure Dashboards, Workbooks etc.</p>

<h3 id="lack-of-notification-channels"><strong>Lack of notification channels</strong></h3>
<p>In Azure Monitor, it is not easy to create incidents and support tickets to the most used platforms like PagerDuty and Service Now. It is not possible to Notify appropriate stakeholders on violations through various collaboration tools like Teams, Slack to stay on top of critical issues.</p>

<p>The email notification templates are pre-defined which the users cannot customise to best of their interest.</p>

<h3 id="all-in-one-solution-for-all-your-azure-monitoring-needs--serverless360"><strong>All-in-one solution for all your Azure monitoring needs – Serverless360</strong></h3>
<p>With a detailed study and understanding of Azure application architectures &amp; its monitoring needs, we built <a href="https://www.serverless360.com/" target="_blank">Serverless360</a> to fill all the gaps in the Azure-native and other third-party monitoring tools currently available in the market.</p>

<p>It has the following capabilities to address the above monitoring challenges.</p>

<p>With Serverless360’s Composite Application feature, you can logically group all your siloed Azure resources in a single pane of glass to monitor in a business application context.<br />
<img src="https://blog.orneling.se/assets/images/2021/02/2021-02-10-Serverless360-1.png" alt="" /><br />
Serverless360 built-in monitors provide you with a consolidated report on the status of all resources of your Azure application<br />
<img src="https://blog.orneling.se/assets/images/2021/02/2021-02-10-Serverless360-2.png" alt="" /><br />
You can monitor any number of resources on multiple metrics in a single alert to eliminate the additional cost<br />
With Serverless360’s extensive monitors, you can monitor the properties and status of the Azure resources with customizable warning and error thresholds to prevent outages
Threshold monitor in Serverless360 allows restoring business by auto-correcting resource state absolutely with no manual intervention<br />
<img src="https://blog.orneling.se/assets/images/2021/02/2021-02-10-Serverless360-3.png" alt="" /><br />
Whether you are running Azure Functions, Logic Apps, Azure Data Factory, or something else entirely – Serverless360 got you covered. Visualize the performance of more than 100+ Azure resources with customizable, plug and play dashboards<br />
<img src="https://blog.orneling.se/assets/images/2021/02/2021-02-10-Serverless360-4.png" alt="" /><br />
Serverless360 supports a wide range of Notification channels like Pager Duty, Slack, OMS, Microsoft Teams along with Webhook and email channels that Azure Monitor does not support.</p>]]></content><author><name>Daniel Örneling</name></author><category term="Azure" /><category term="Azure Monitor" /><category term="Serverless360" /><category term="Serverless" /><summary type="html"><![CDATA[In the cloud adoption era, organizations urge to deploy their system to a modern cloud for a competitive edge. Microsoft made great strides in providing enterprise-grade to run highly scalable and reliable services. Given that, many Fortune 500 companies like Walmart selected Microsoft Azure as their solution providers. Applications provisioned on Azure are built on top of architecture that is siloed and highly dynamic. Hence, it is inevitable to monitor the applications and services of Azure to maximise the availability, performance, reliability, and consumption.]]></summary></entry><entry><title type="html">ARM Templates: Deploying Azure Monitor Alerts</title><link href="https://blog.orneling.se/2020/06/arm-templates-deploying-azure-monitor-alerts" rel="alternate" type="text/html" title="ARM Templates: Deploying Azure Monitor Alerts" /><published>2020-06-03T00:00:00+02:00</published><updated>2020-06-03T00:00:00+02:00</updated><id>https://blog.orneling.se/2020/06/arm-templates-deploying-azure-monitor-alerts</id><content type="html" xml:base="https://blog.orneling.se/2020/06/arm-templates-deploying-azure-monitor-alerts"><![CDATA[<p>In my series of blog posts about working with ARM templates I have gone through a lot of different use cases. In the last post I covered how to deploy a nested template to keep the main template a lot cleaner. One thing all posts have in common is that I´m using Azure Monitor as the main track which I´m deploying. I have deployed dozens of Log Analytics Workspaces for this. Now it´s time for deploying Azure Monitor alerts as well.</p>

<p>Firstly, if you haven´t read my previous posts about ARM Templates you can find them below:</p>

<ul>
  <li><a href="https://blog.orneling.se/2020/03/getting-started-with-azure-arm-templates" target="_blank">Getting started with Azure ARM templates</a></li>
  <li><a href="https://blog.orneling.se/2020/03/arm-templates-working-with-naming-conventions" target="_blank">ARM Templates: Working with naming conventions</a></li>
  <li><a href="https://blog.orneling.se/2020/04/arm-templates-working-with-tags-in-azure" target="_blank">ARM Templates: Working with tags in Azure</a></li>
  <li><a href="https://blog.orneling.se/2020/04/arm-templates-working-with-parameters-in-azure" target="_blank">ARM Templates: Working with parameters in Azure</a></li>
  <li><a href="https://blog.orneling.se/2020/05/arm-templates-working-with-nested-templates-in-azure" target="_blank">ARM Templates: Working with nested templates in Azure</a></li>
</ul>

<p>I am deploying a workspace with a bunch of performance counters pre-configured on which the alerts rely on. If you don’t know how to do that yet, go through the previous posts where I show it in detail.
<!--More--></p>
<h3 id="preparing-the-main-template-with-parameters-and-variables"><strong>Preparing the main template with parameters and variables</strong></h3>

<p>Before we can deploy the alert rules, we need to state what kind of information we need. The first thing I´m going to do is to set the e-mail recipient of the alerts I will be creating. There is a possibility to ad SMS recipients as well, but I won´t go through that in this post. Basically, what you need to state is the name of the recipient and it´s e-mail address. I´ve chosen to put this as a parameter since this is most likely something that will change for most deployments.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/06/azure-monitor-alerts-1.png" alt="Azure ARM Template - Azure Monitor alert recipient" /></p>

<p>The next thing I will do is to prepare the name of the action group to create, and a short name for it as variables. What you need to know is that the short name can never exceed 12 characters. That´s why I´ve put a rather simple name for it with the workspace name followed by “-AG”.</p>

<p>The QueriesAlertsLink variable is pointing to my Azure storage account, but you can use the link already in the template as it´s publicly accessible. This is where the main template will look for the nested template containing all the alert rules.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/06/azure-monitor-alerts-2.png" alt="Azure ARM Template - Variables" /></p>

<h3 id="preparing-the-main-template-with-the-resources-needed"><strong>Preparing the main template with the resources needed</strong></h3>

<p>In this main template we will add two resources. An action group and a nested deployment looking at the alert template itself.</p>

<p>As you can see below, I have highlighted the most important things in this deployment. As I mentioned above, you can create SMS recipients as well, but for this demo I will only add myself with my e-mail address. The action group depends on the workspace which is created through the main template, and it´s also towards that workspace the alerts will look for the information to trigger on.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/06/azure-monitor-alerts-3.png" alt="Azure ARM Template - Azure Monitor alert deployment" /></p>

<p>The nested deployment itself isn´t that different from what I showed in my previous post. It´s basically another template and with one more parameter passed on, the actionGroupName variable. If you´re curious for more information about nested templates, read about that <a href="https://blog.orneling.se/2020/05/arm-templates-working-with-nested-templates-in-azure/">here</a>.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/06/azure-monitor-alerts-4.png" alt="Azure ARM Template - Nested template deployment" /></p>

<h3 id="looking-at-the-template-containing-the-alert-rules"><strong>Looking at the template containing the alert rules</strong></h3>

<p>Looking at the template used for deploying Azure Monitor alerts, we can see the parameters section will get the information that is being pushed in during the deployment. The workspace and action group name is used to pick up the resource Id of those two resources to be used later on.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/06/azure-monitor-alerts-5.png" alt="Azure ARM Template - Parameters" /></p>

<p>The information needed to declare an alert in an ARM template is seen below. I have highlighted the important things that make up the alert itself. You can see I´ve pointed out the location of the workspace, the workspace as the data source and the query to run.</p>

<p>When it comes to the schedule, the maximum number you can set (as of the time writing this post) is 1440 minutes, which is equal to 24 hours.</p>

<p>I also tell which action group to use, along with the formatting of the alert being sent out.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/06/azure-monitor-alerts-6.png" alt="Azure ARM Template - Deploying Azure Monitor alerts" /></p>

<h3 id="post-deployment-checkup-in-the-azure-portal"><strong>Post-deployment checkup in the Azure portal</strong></h3>

<p>As soon as the deployment succeeded, we can head into the Monitor section of the Azure portal and find our alert rules. All we need to do is to highlight the resource group we´re looking at. Now, we will immediately see all alerts that´s been created. As you can see below as well, the “Workspace-Finance-001” workspace is being used as the data source for those alert rules.</p>

<p>As soon as one of the queries has a result count of 1 or more, the alert will fire and in this case, I will receive an e-mail.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/06/azure-monitor-alerts-7.png" alt="Azure ARM Template - Azure Monitor alert rules" /></p>

<h3 id="summary"><strong>Summary</strong></h3>

<p>As you see here, deploying Azure Monitor alerts don´t need to be that complicated. Sure, there´s a bit of a learning curve of doing it with ARM templates but once passed that it´s a lot faster.</p>

<p>The template itself isn´t that complicated, but there are some things to think about. The main thing I want to point out is the action group short name which needs to be a maximum of 12 letters. If you want to read more about setting up Azure Monitor alerts using ARM templates, look <a href="https://docs.microsoft.com/en-us/azure/azure-monitor/samples/resource-manager-samples">here</a>.</p>

<p>I have uploaded the templates and the PowerShell deployment script to my GitHub repo, which you can find <a href="https://github.com/DanielOrneling/BlogSamples/tree/master/NestedTemplateAlertsSample" target="_blank">here</a>. Use them just as you want.</p>

<p>If you have any comments or questions, leave a comment below and I´ll get back as soon as possible.</p>]]></content><author><name>Daniel Örneling</name></author><category term="arm-templates" /><category term="azure" /><category term="azure-monitor" /><category term="log-analytics" /><category term="orneling-se" /><category term="armtemplates" /><category term="azure" /><category term="azure-monitor" /><category term="resourcemanager" /><summary type="html"><![CDATA[In my series of blog posts about working with ARM templates I have gone through a lot of different use cases. In the last post I covered how to deploy a nested template to keep the main template a lot cleaner. One thing all posts have in common is that I´m using Azure Monitor as the main track which I´m deploying. I have deployed dozens of Log Analytics Workspaces for this. Now it´s time for deploying Azure Monitor alerts as well. Firstly, if you haven´t read my previous posts about ARM Templates you can find them below: Getting started with Azure ARM templates ARM Templates: Working with naming conventions ARM Templates: Working with tags in Azure ARM Templates: Working with parameters in Azure ARM Templates: Working with nested templates in Azure I am deploying a workspace with a bunch of performance counters pre-configured on which the alerts rely on. If you don’t know how to do that yet, go through the previous posts where I show it in detail.]]></summary></entry><entry><title type="html">ARM Templates: Working with nested templates in Azure</title><link href="https://blog.orneling.se/2020/05/arm-templates-working-with-nested-templates-in-azure" rel="alternate" type="text/html" title="ARM Templates: Working with nested templates in Azure" /><published>2020-05-20T00:00:00+02:00</published><updated>2020-05-20T00:00:00+02:00</updated><id>https://blog.orneling.se/2020/05/arm-templates-working-with-nested-templates-in-azure</id><content type="html" xml:base="https://blog.orneling.se/2020/05/arm-templates-working-with-nested-templates-in-azure"><![CDATA[<p>Working with nested templates in Azure ARM templates is something that not all are using, and I don´t think everyone knows about it either. Nested templates are helpful when you want to do a more complex deployment of some resources. Basically, what this means is that you can deploy multiple templates from a single main template. You use one single parameters file and then pass those parameters on to the nested templates along the way.</p>

<p>In my previous posts in this ARM template seriesyou can see how to get started, from using tags to how to work with parameters. But one more thing I want to show is how to work with more complex deployments, and that´s where nested templates come in.
<!--More--></p>
<h3 id="the-goal-of-the-deployment">The goal of the deployment</h3>

<p>With this ARM template, I will deploy a Log Analytics workspace along with a bunch of performance counters and a bunch of saved searches (queries). The information I´m including is something I´ve based on how SCOM collects information about things as CPU usage, memory usage etc. Near real time performance counter collection is cool, but how often do we really need that?</p>

<p>The timing of the collection intervals I´ve gone with here is either five or ten minutes.</p>

<h3 id="adding-a-performance-counter-to-the-template">Adding a performance counter to the template</h3>

<p>When wanting to add anything, such as in this case a performance counter or an event log, we need to look in the resources section of the resource itself. In this case it´s a workspace.</p>

<p>As you can see below, there are some information needed, but everything is quite straight forward once you get a hold of it. The name of the resource as seen below needs to be unique for the template. There are a total of twelve performance counters added with this template, along with the System, Application and Setup event logs.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/05/nested-templates-1.png" alt="" /></p>

<h3 id="adding-saved-searches-to-a-template">Adding saved searches to a template</h3>

<p>Looking at the template to be used as the nested template, there are some things to tink about. First, the parameter (in this case WorkspaceName) can´t have a value. Just define it as string as seen below. This way, the vaue will be used that we´re passing along from the main template.</p>

<p>When it comes to the resources, it´s not a big difference in how you write it. In this case we include saved searches as seen below, but it could just as well be an automation account, storage account or whatever. The same thing goes for other resource types as well.</p>

<p>Looking at the “Query” section below, the \r\n in the query are JSON formatting to switch line in the query.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/05/nested-templates-2.png" alt="" /></p>

<h3 id="calling-the-nested-template">Calling the nested template</h3>

<p>What I´ve done for this demo is that I have uploaded the template I will be calling to an Azure storage account that allows anonymous access. In other words, you can use this URL when trying it out yourself.</p>

<p>This variable will be used when the main template calls the nested one, and knows where to find it.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/05/nested-templates-3.png" alt="" /></p>

<p>Using a nested template is quite easy actually. Just need to understand the language to be used first (of course). It goes in to the template as a resource and there are some things you need to be aware of.</p>

<p>In the properties section, set the mode to incremental and the URI to the link where to find the nested template. To make thins easier and look cleaner, I have created a variable containing the URI of the template.</p>

<p>You can also choose to pass parameters on to the nested template. See below for how that´s done. This is why you should never set a value for the parameter in the nested template as I mentioned above. If there is a value in the nested template, the value you pass on from here will be overwritten by the default value in the nested template.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/05/nested-templates-4.png" alt="" /></p>

<h3 id="deploying-the-template">Deploying the template</h3>

<p>As usual, I have used a PowerShell script to deploy the template. Find the link in the end of the post.</p>

<p>As you can see there have been some tagging, you can see the workspace name and location.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/05/nested-templates-5.png" alt="" /></p>

<h3 id="looking-at-the-results">Looking at the results</h3>

<p>When we look into the advanced settings section of the workspace, we can see that our performance counters have been deployed. Together with the timing intervals I mentioned above. These counters will now be collected from the servers reporting to the workspace, and can be used when writing queries.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/05/nested-templates-6.png" alt="" /></p>

<p>When it comes to the queries we deployed with the nested template, these can be seen in the Saved Searches section of the workspace. Some queries with basic checks for CPU, disk and memory (and some more) that can be used to generate alerts when something happens with your server(s).</p>

<p><img src="https://blog.orneling.se/assets/images/2020/05/nested-templates-7.png" alt="" /></p>

<h3 id="summary">Summary</h3>

<p>When I first heard of nested templates I thought it sounded cool but awefully complicated. However once I started looking into it, it turned out to be cool and surprisingly easy to get going with.</p>

<p>This is a great way to divide a large main template into a smaller main template with multiple smaller templates to be called. This makes it a lot easier to build more complex solutions as these can be tailor made including just the components you want.</p>

<p>I have uploaded the templates and the PowerShell deployment script to my GitHub repo, which you can find <a href="https://github.com/DanielOrneling/BlogSamples/tree/master/NestedTemplateSample" target="_blank">here</a></p>

<p>If you havent read my previous posts about ARM Templates you can find them below:</p>

<ul>
  <li><a href="https://blog.orneling.se/2020/03/getting-started-with-azure-arm-templates" target="_blank">Getting started with Azure ARM templates</a></li>
  <li><a href="https://blog.orneling.se/2020/03/arm-templates-working-with-naming-conventions" target="_blank">ARM Templates: Working with naming conventions</a></li>
  <li><a href="https://blog.orneling.se/2020/04/arm-templates-working-with-tags-in-azure" target="_blank">ARM Templates: Working with tags in Azure</a></li>
  <li><a href="https://blog.orneling.se/2020/04/arm-templates-working-with-parameters-in-azure" target="_blank">ARM Templates: Working with parameters in Azure</a></li>
</ul>

<p>As always, if you have any comments or questions, leave a comment below and I´ll get back as soon as possible.</p>

<p>Stay tuned for more posts on cool Azure technologies.</p>]]></content><author><name>Daniel Örneling</name></author><category term="arm-templates" /><category term="azure" /><category term="azure-monitor" /><category term="orneling-se" /><category term="arm" /><category term="armtemplates" /><category term="azure" /><category term="azuremonitor" /><summary type="html"><![CDATA[Working with nested templates in Azure ARM templates is something that not all are using, and I don´t think everyone knows about it either. Nested templates are helpful when you want to do a more complex deployment of some resources. Basically, what this means is that you can deploy multiple templates from a single main template. You use one single parameters file and then pass those parameters on to the nested templates along the way. In my previous posts in this ARM template seriesyou can see how to get started, from using tags to how to work with parameters. But one more thing I want to show is how to work with more complex deployments, and that´s where nested templates come in.]]></summary></entry><entry><title type="html">ARM Templates: Working with parameters in Azure</title><link href="https://blog.orneling.se/2020/04/arm-templates-working-with-parameters-in-azure" rel="alternate" type="text/html" title="ARM Templates: Working with parameters in Azure" /><published>2020-04-29T00:00:00+02:00</published><updated>2020-04-29T00:00:00+02:00</updated><id>https://blog.orneling.se/2020/04/arm-templates-working-with-parameters-in-azure</id><content type="html" xml:base="https://blog.orneling.se/2020/04/arm-templates-working-with-parameters-in-azure"><![CDATA[<p>Working with parameters in Azure is something I want to discuss a bit more than what I´ve done earlier. Azure tags have recently been covered on this blog, my previous post about that can be found <a href="https://blog.orneling.se/2020/04/arm-templates-working-with-tags-in-azure" target="_blank">here</a>. Since I posted that article, I had another Azure blogger, Martin Ehrnst who is also an Azure MVP <a href="https://adatum.no/" target="_blank">his blog here</a> reached out to me teaching me a few things. When I did the last Azure tags post, I created one parameter for each tag I wanted to create. However, that´s not necessary.</p>

<p>Instead of creating one parameter for each tag, I have switched over to a new way of doing it. Instead of creating a single string, I create the tags as an object type. This means that I will be able to pass multiple values (in this case its tags) as one parameter instead. Have a look below.
<!--More--></p>
<h3 id="the-single-value-way-vs-the-multiple-values-way"><strong>The single value way vs the multiple values way</strong></h3>

<p>The two examples below show the single string way, while the other shows the object type way. By doing this we can shave off lots of code, but we can also save a lot of parameters. For this small example it makes no real difference in functionality. But in larger deployments it can help as there´s a limit of 255 parameters per deployment.</p>

<p>The amount of tags I put in is the same, but here it´s combined into one single parameter instead of three. The main difference is that I erase the single parameter (the bottom square) and rely only on the upper one instead.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/parameters-1.png" alt="" /></p>

<h3 id="using-the-parameter-values"><strong>Using the parameter values</strong></h3>

<p>When referencing the values of the multiple value parameter, there is a slight change. Before, we could just reference the whole parameter, but now we need to break it down a little.</p>

<p>Before we had to write <em>“[concat(parameters(‘Department’))]”</em> for example, but now we need to write <em>“[concat(parameters(‘Tags’).Department)]”</em> instead. In other words, we change the main parameter we´re calling and adding the value which in this example is Department.</p>

<p>This way of doing things is not limited to tags in any way, but it can be used for any parameter of your choice.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/parameters-2.png" alt="" /></p>

<h3 id="changing-the-parameters-file"><strong>Changing the parameters file</strong></h3>

<p>Now when we´ve changed the way we´re writing the parameters, we also need to update the parameters file as well. Of course, you don´t need a template file, but I highly recommend it. Thatway you don´t have to edit the main template every time you want to change an input value. What we need to do is to add the different values into the “value”:{} section of the parameter. As you can see below, it´s pretty much the same but with some minor changes.</p>

<p><em>The Department parameter in the bottom square is not in the final parameters file. It´s only there for the purpose of this demo.</em></p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/parameters-3.png" alt="" /></p>

<h3 id="deploying-the-template"><strong>Deploying the template</strong></h3>

<p>When deploying the template, I have used the same PowerShell script I´ve been using for the past few blog posts in this ARM Template series.</p>

<p>What you see below is the output in PowerShell after a successful deployment.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/parameters-4.png" alt="" /></p>

<p>Looking in the Azure portal we can see the tags are added just as expected. There´s no difference in the functionality with this better way of doing parameters, it just saves us time and lines of code.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/parameters-5.png" alt="" /></p>

<h3 id="summary"><strong>Summary</strong></h3>

<p>So this was another blog post in my series where I go through how to work with ARM Templates for you Azure deployments. As soon as I heard about this I checked it out, and in about 10 minutes I was up to speed and had made the changes necessary to make the change. Thank you Martin!</p>

<p>I have posted the sample templates and the deployment script I´ve been using to my Github repo and you can find the files <a href="https://github.com/DanielOrneling/BlogSamples/tree/master/ConcatenateSampleTags" target="_blank">here</a>. There´s also a great article from Microsoft <a href="https://docs.microsoft.com/en-us/azure/architecture/building-blocks/extending-templates/objects-as-parameters" target="_blank">here</a>, which explains the things I´ve done here if you´re curious about more.</p>

<p>If you havent read my previous posts about ARM Templates you can find them below:</p>

<ul>
  <li>
    <p><a href="https://blog.orneling.se/2020/03/getting-started-with-azure-arm-templates" target="_blank">Getting started with Azure ARM templates</a></p>
  </li>
  <li>
    <p><a href="https://blog.orneling.se/2020/03/arm-templates-working-with-naming-conventions" target="_blank">ARM Templates: Working with naming conventions</a></p>
  </li>
  <li>
    <p><a href="https://blog.orneling.se/2020/04/arm-templates-working-with-tags-in-azure" target="_blank">ARM Templates: Working with tags in Azure</a></p>
  </li>
</ul>

<p>If you have any questions or concerns, leave a comment below and I´ll get back asap.</p>]]></content><author><name>Daniel Örneling</name></author><category term="arm-templates" /><category term="azure" /><category term="azure-monitor" /><category term="orneling-se" /><category term="powershell" /><category term="armtemplates" /><category term="azure" /><category term="azuremonitor" /><category term="powershell" /><summary type="html"><![CDATA[Working with parameters in Azure is something I want to discuss a bit more than what I´ve done earlier. Azure tags have recently been covered on this blog, my previous post about that can be found here. Since I posted that article, I had another Azure blogger, Martin Ehrnst who is also an Azure MVP his blog here reached out to me teaching me a few things. When I did the last Azure tags post, I created one parameter for each tag I wanted to create. However, that´s not necessary. Instead of creating one parameter for each tag, I have switched over to a new way of doing it. Instead of creating a single string, I create the tags as an object type. This means that I will be able to pass multiple values (in this case its tags) as one parameter instead. Have a look below.]]></summary></entry><entry><title type="html">ARM Templates: Working with tags in Azure</title><link href="https://blog.orneling.se/2020/04/arm-templates-working-with-tags-in-azure" rel="alternate" type="text/html" title="ARM Templates: Working with tags in Azure" /><published>2020-04-22T00:00:00+02:00</published><updated>2020-04-22T00:00:00+02:00</updated><id>https://blog.orneling.se/2020/04/arm-templates-working-with-tags-in-azure</id><content type="html" xml:base="https://blog.orneling.se/2020/04/arm-templates-working-with-tags-in-azure"><![CDATA[<p>Working with tags in Azure is a really important thing. It´s something that everyone should do as soon as they start to move workloads to Azure. In my last two posts I showed how to get started <a href="https://blog.orneling.se/2020/03/getting-started-with-azure-arm-templates" target="_blank">here</a>. And <a href="https://blog.orneling.se/2020/03/arm-templates-working-with-naming-conventions" target="_blank">here</a> I showed how to comply with your naming conventions for Azure resources as well. The two examples I showed in those posts aren´t at all complicated, but they lack one major thing. Tags.
<!--More--></p>
<h3 id="first-things-first-why-should-you-work-with-tags">First things first, why should you work with tags?</h3>

<p>Tagging resources is a way to keep track of things like who is the owner, what department it belongs to, the environment and cost center to name a few examples. In a small Azure environment with just a few resources, it´s quite easy to keep track of the resources as is. But once you build a larger environment you´re going to need tagging to keep track of the different resources.</p>

<p>Using tags is also a way to control how much money a team is spending on Azure resources. This way you can get a cost analysis based on certain tags.</p>

<h3 id="get-started-using-tags-in-azure"><strong>Get started using tags</strong> in Azure</h3>

<p>For this example, I´m going to use an ARM template to apply tags to resources as a part of the deployment. The example is the same as was used in my last post about naming conventions, but with a few changes.</p>

<p>The first thing I have done is to add three new parameters: Department, Environment and Owner. Nothing fancy, you just copy a previous parameter and switch out the values to the new one you desire.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/tags-1.jpg" alt="" /></p>

<p>The next step is to insert the tagging information in the ARM template in the right place. It should be inserted like you can see below right between “location” and “properties”. You just insert the tag as “TagName”: “[parameters(‘TagName’)]” followed by the rest of the tags.</p>

<p>And that´s it for the arm template in this example. You just need to repeat this process for each different resource you have added to your template. Just paste the information right between location and properties on the rest of the resources and you´re good to go.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/tags-2.jpg" alt="" /></p>

<h3 id="deploying-the-template-and-verifying-its-function"><strong>Deploying the template and verifying its function</strong></h3>

<p>I used the same PowerShell script as last time to deploy the ARM template. As you can see here it lists the parameters we typed in and all looks good.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/tags-3.jpg" alt="" /></p>

<p>Looking in the Azure portal we can see the new workspace created, along with the tags we provided.</p>

<p>Tagging resources isn´t at all complicated, but it adds a real value useful in multiple scenarios. Just to be able to check who is spending the most money or to see which department using the most resources is a completely new way to keep track of the expense in the company.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/tags-4.jpg" alt="" /></p>

<h3 id="checking-all-resources-with-a-certain-tag"><strong>Checking all resources with a certain tag</strong></h3>

<p>As you can see in the below picture you can push the button, I pointed out to see all resources with that certain tag. In my case where it´s my own lab environment there’s no chock that most resources are tagged with my name, but in a live customer environment this is a great way to find the person responsible for the resource. In this view, you can also add new tags to a resource.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/tags-5.jpg" alt="" /></p>

<p>Below is a view where you can see all resources tagged with me as the owner.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/04/tags-6.jpg" alt="" /></p>

<h3 id="summary"><strong>Summary</strong></h3>

<p>This post isn´t as long as they usually are, and that´s basically since tagging resources is a real straight-forward task and not at all complicated. Even though it isn´t complicated at all, it really adds value since we can follow up on resources in a completely different way than we could before tags was introduced.</p>

<p>With this post I wanted to show how simple it is to start tagging, but also to explain why you should use it. I really think that tagging resources should be a part of the routines when deploying new resources, as it helps big time when finding owners or doing cost analysis for the resources.</p>

<p>I have uploaded the ARM template sample to my GitHub repo and you can download it from <a href="https://github.com/DanielOrneling/BlogSamples/tree/master/TagsSample" target="_blank">here</a>. As always if you have any questions do not hesitate to leave a comment below.</p>]]></content><author><name>Daniel Örneling</name></author><category term="arm-templates" /><category term="azure" /><category term="orneling-se" /><category term="armtemplates" /><category term="azure" /><category term="azuremonitor" /><category term="tags" /><summary type="html"><![CDATA[Working with tags in Azure is a really important thing. It´s something that everyone should do as soon as they start to move workloads to Azure. In my last two posts I showed how to get started here. And here I showed how to comply with your naming conventions for Azure resources as well. The two examples I showed in those posts aren´t at all complicated, but they lack one major thing. Tags.]]></summary></entry><entry><title type="html">ARM Templates: Working with naming conventions</title><link href="https://blog.orneling.se/2020/03/arm-templates-working-with-naming-conventions" rel="alternate" type="text/html" title="ARM Templates: Working with naming conventions" /><published>2020-03-30T00:00:00+02:00</published><updated>2020-03-30T00:00:00+02:00</updated><id>https://blog.orneling.se/2020/03/arm-templates-working-with-naming-conventions</id><content type="html" xml:base="https://blog.orneling.se/2020/03/arm-templates-working-with-naming-conventions"><![CDATA[<p>In my last post which you can find <a href="https://blog.orneling.se/2020/03/getting-started-with-azure-arm-templates" target="_blank"><em>here</em></a>, I wrote about how to get started writing ARM templates for you Azure deployments. In the end I provided an ARM template built solely for that blog post. But the template was really basic and didn’t have much logic built into it, except for addressing a parameter to name the automation account and a variable to set the location where to create the automation account.</p>

<p>As long as you don´t need anything else than just setting a simple name, that sample template works fine to create a simple automation account. But what if you want to comply with your naming conventions that you´ve come up with for your cloud resources? To do this we need to look at another ARM template function, which I use heavily to set the correct names etc. for my resources.
<!--More--></p>
<h3 id="concatenate">Concatenate</h3>

<p>The function I´m talking about is called concatenate and it´s used to combine several different input values and some static information if that´s needed. For this blog post I´m going to demonstrate how you can create a new empty Log Analytics workspace, combining different parameters for the purpose of naming the resource using the concatenate function. The three sections of the ARM template we´re interested in for this demo are parameters, variables and resources. Those three will be used together to finalize the naming of the resource.</p>

<h4 id="parameters"><strong>Parameters</strong></h4>

<p>To be able to combine values, we need to put in a bunch of parameters. For this example, we will put in name, location and the department for which the workspace is deployed. You can see the complete parameters section below, just like we did in the last blog post. The only new addition is that I have used several different regions where the workspace can be deployed. If you try to put it in any other region than the ones I have typed below, the deployment will fail immediately, and you will have to go back and change the value.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/03/arm-naming-1.jpg" alt="" /></p>

<h4 id="variables"><strong>Variables</strong></h4>

<p>For this example, we will use two different variables. A variable can be a hard-coded value, such as License below, but it can also be a combination of different values. That´s where the concatenate function comes into play.</p>

<p>In this case, I want my workspace to be named “Workspace-Department-001”. To be able to achieve this, we need to type like I have done in the picture below. In real life, this workspace will be named “Workspace-HumanResources-001”. It can be a little tricky at first with this concatenate function, but once you get a hold of it, it´s really neat to know and it will help you leave those hard-coded values that no one ever really wants to use.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/03/arm-naming-2.jpg" alt="" /></p>

<h4 id="resources"><strong>Resources</strong></h4>

<p>To deploy our workspace, we need to use a resource of the type “Microsoft.OperationalInsights/workspaces”. The code you see below is also available as a snippet in the Azure Resource Manager Snippets _<a href="https://marketplace.visualstudio.com/items?itemName=samcogan.arm-snippets" target="_blank">extension</a> I recommended in my last post. For this workspace to look the way we want, we need to change three values: name, location and sku.</p>

<p>See below for what it should look like in your template.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/03/arm-naming-3.jpg" alt="" /></p>

<h3 id="the-complete-template"><strong>The complete template</strong></h3>

<p>The complete template consists of 56 lines of code and will be deployed using the parameter values set in my “azureDeploy.parameters.json” file. I will link the template below for you to use however you like and to build upon. These 56 lines of code is really all you need to deploy a workspace with this naming convention, and you don´t ever need to touch most of these lines at all.</p>

<h3 id="deploying-the-workspace"><strong>Deploying the workspace</strong></h3>

<p>As last time, I have provided a PowerShell script that you can use to deploy the template, that will also be linked below together with the template files.</p>

<p>The deployment took about five seconds using PowerShell through VS Code and you can see the values from the parameters in the picture below.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/03/arm-naming-4.jpg" alt="" /></p>

<p>Looking in the Azure portal we can find the new workspace in our shiny new resource group. The workspace has now been deployed and is ready to start collecting your information from servers, web apps, metrics and much more.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/03/arm-naming-5.jpg" alt="" /></p>

<h3 id="the-resources-used-for-this-post"><strong>The resources used for this post</strong></h3>

<p>You can find the template files needed along with the PowerShell script to deploy it in my GitHub repo <a href="https://github.com/DanielOrneling/BlogSamples/tree/master/ConcatenateSample" target="_blank"><em>here</em></a>. Feel free to use it whichever way you like, it´s there for you to develop and to keep learning about writing ARM templates.</p>

<h3 id="summary"><strong>Summary</strong></h3>

<p>As you have seen in this post, it doesn’t have to be that hard to leave the hard-coded values and going over to complying with your previously stated naming conventions. To be able to put together the resource name from several parameters instead, you can make your Azure environment a whole lot cleaner, and make it a lot easier to find which resources belongs to which department.</p>

<p>If you have any questions about what I´ve done here or just want to leave a tip for other readers, leave a comment below. Stay tuned for more posts in this ARM template deep-dive, next up is tagging the resources.</p>

<p>If you want to see another example of the concatenate function, you can have a look at Microsoft’s example <a href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-array#concat" target="_blank"><em>here</em></a>.</p>]]></content><author><name>Daniel Örneling</name></author><category term="arm-templates" /><category term="azure" /><category term="azure-monitor" /><category term="azure-operational-insights" /><category term="log-analytics" /><category term="orneling-se" /><category term="powershell" /><category term="armtemplates" /><category term="azure" /><category term="azuremonitor" /><category term="json" /><category term="log-analytics" /><category term="resourcemanager" /><summary type="html"><![CDATA[In my last post which you can find here, I wrote about how to get started writing ARM templates for you Azure deployments. In the end I provided an ARM template built solely for that blog post. But the template was really basic and didn’t have much logic built into it, except for addressing a parameter to name the automation account and a variable to set the location where to create the automation account. As long as you don´t need anything else than just setting a simple name, that sample template works fine to create a simple automation account. But what if you want to comply with your naming conventions that you´ve come up with for your cloud resources? To do this we need to look at another ARM template function, which I use heavily to set the correct names etc. for my resources.]]></summary></entry><entry><title type="html">Getting started with Azure ARM templates</title><link href="https://blog.orneling.se/2020/03/getting-started-with-azure-arm-templates" rel="alternate" type="text/html" title="Getting started with Azure ARM templates" /><published>2020-03-24T00:00:00+01:00</published><updated>2020-03-24T00:00:00+01:00</updated><id>https://blog.orneling.se/2020/03/getting-started-with-azure-arm-templates</id><content type="html" xml:base="https://blog.orneling.se/2020/03/getting-started-with-azure-arm-templates"><![CDATA[<p>The first time I heard about JSON and ARM templates together with Azure in the same sentence, was in Chicago at Microsoft Ignite back in 2015. My first thought was, what are they all talking about? This was of course during the shift from Azure “classic” which was based on XML, to Azure “Resource Manager” which is based on JSON instead.</p>

<p>As I mentioned, this was back in 2015 so nearly five years ago now, but even more important nowadays. My first experience with this new way of working with Azure was a bit of a rollercoaster, every time I grasped something, another thing showed up that made absolutely no sense at the time. Back then I looked at a lot of sample templates and practiced my copy/paste skills to build a template that was deploying the resources I wanted to deploy.</p>

<h3 id="the-foundation"><strong>The foundation</strong></h3>

<p>Now it´s 2020 and a lot has happened in many ways, and thankfully it´s a lot easier to get started writing ARM templates with a bunch of different tools, of which of I´m going to show a few in this post. If you don´t know what an ARM template is, it´s basically a JSON file which define the objects you want to deploy, their names, types and properties. This file is then read by the Azure Resource Manager API and deployed in the exact same way each time you run it. If something already exists, it checks for changes and if there are no changes it just skips that part of the template.</p>

<h3 id="the-base-template">The base template</h3>

<p>The base template looks like below and consists of several different sections.</p>

<ul>
  <li><strong>Parameters:</strong> Can be set to a default value, with a drop-down list of allowed values (which regions you can deploy to for example) and can be changed upon deployment.</li>
  <li><strong>Variables:</strong> Used in the resources section of the template. Can be a combination of several parameters, or just hard-coded values. Used to define naming standards just to mention one use case.</li>
  <li><strong>Resources:</strong> The resources to be deployed along with it´s name, properties and tags etc.</li>
  <li><strong>Outputs:</strong> Used to return values from the template, the endpoints of a storage account for example</li>
</ul>

<p><img src="https://blog.orneling.se/assets/images/2020/03/arm-templates-start-4.jpg" alt="" /></p>

<p>The base template.</p>

<h3 id="getting-started-writing-code"><strong>Getting started writing code</strong></h3>

<p>Over the years I have come to a good understanding of ARM templates and how to write them to do the things I want them too, but it hasn´t been easy. To help you get started, I want to recommend those tools I use in my work with ARM templates to make things and life in general a lot easier. And it also saves a lot of time. With these tools I´m about to recommend I can build a new ARM template to deploy a new automation account or a Log Analytics workspace in about five minutes, and that´s with some tweaking of the naming etc.</p>

<p>The first tool I recommend using as the foundation is Visual Studio Code, which is an awesome tool to write code. I use it to write PowerShell, JSON and also YAML (for my home automation). If you haven´t tried it yet, download it <a href="https://code.visualstudio.com/download">here</a> to get started. A pro tip is to create a new file and just saving it as “new-file.json” or .ps1 for example, just keep the “” when you save it. VS Code will then recognize it´s either a JSON file or a PowerShell script, and highlight the script in a correct and easy-to-work-with way.</p>

<h3 id="visual-studio-code-extensions"><strong>Visual Studio Code Extensions</strong></h3>

<h4 id="azure-resource-manager-arm-tools"><strong>Azure Resource Manager (ARM) Tools</strong></h4>

<p>This is the first extension to install when looking at writing ARM templates using VS Code. With this extension, VS Code understands Azure Resource Manager deployment template files. It also helps pointing out sections where the JSON code is faulty.</p>

<p>With this extension you get some snippets to start building your templates. Just type arm! in a json file and you will get to choose from the below snippets.</p>

<ul>
  <li>arm! - Adds the framework for a full deployment template file for resource group deployments</li>
  <li>arm!s - Adds the framework for a full deployment template file for subscription deployments</li>
  <li>arm!mg - Adds the framework for a full deployment template file for management group deployments</li>
  <li>arm!t - Adds the framework for a full deployment template file for tenant deployments</li>
  <li>armp! - Adds the framework for a full deployment template parameters file</li>
</ul>

<p>Download the extension from Visual Studio Marketplace <a href="https://marketplace.visualstudio.com/items?itemName=msazurermtools.azurerm-vscode-tools" target="_blank">here</a>, or from within VS Code directly (see below), from the Extensions section. At the extension page, you can also see all the snippets available.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/03/arm-templates-start-1.jpg" alt="" /></p>

<p>The extensions pane of VS Code</p>

<h4 id="azure-resource-manager-snippets"><strong>Azure Resource Manager Snippets</strong></h4>

<p>When I said I can write a new template in five minutes, I am relying on an extension written by MVP <a href="http://samcogan.com/">Sam Cogan</a>. It´s by far the extension I have had the most use of so far. It consists of a bunch of snippets which lets you deploy the resources you want. All you have to do is to launch a new json file and start typing “arm-“ and the snippets will show up and you can choose whichever you would like to use. Start with a Skeleton ARM Template (provided by the first extension above) and you will get the content shown above, ready to be filled up with different parameters and resources etc. It can also help you write the parameters necessary. Find a complete sample template further down in the article.</p>

<p>Download the extension <a href="https://marketplace.visualstudio.com/items?itemName=samcogan.arm-snippets" target="_blank">here</a> or through VS Code Extensions as shown above.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/03/arm-templates-start-2.jpg" alt="" /></p>

<p>Some of the available snippets</p>

<h4 id="arm-params-generator"><strong>ARM Params Generator</strong></h4>

<p>The next extension on my list is one that helps generating a parameters file. This file is used to point out the custom values that are to be changed upon deployment and consists of only a parameters section with the different values. Once you have created your ARM template and have installed this extension, just right click somewhere in the code section and choose “Azure ARM: Generate parameters file”, and it will create a file named “templatename.parameters.json”. See below what it looks like.</p>

<p><img src="https://blog.orneling.se/assets/images/2020/03/arm-templates-start-3.jpg" alt="" /></p>

<p>Generate a parameters file for your ARM template</p>

<p><img src="https://blog.orneling.se/assets/images/2020/03/arm-templates-start-5.jpg" alt="" /></p>

<p>The parameters file. Find the source code further down.</p>

<p>Download the extension <a href="https://marketplace.visualstudio.com/items?itemName=wilfriedwoivre.arm-params-generator" target="_blank">here</a> or through VS Code Extensions as shown above.</p>

<h4 id="jsonlint"><strong>JSONLint</strong></h4>

<p>The last tip for the day is a web site helping you validate your JSON code. It points you to where you need to check your code, which have saved me numerous times since it´s really easy to miss an indentation or a parenthesis or whatever when writing code. Find the JSON validator <a href="https://jsonlint.com/" target="_blank">here</a> and remember to bookmark it, cause you will need it.</p>

<h4 id="sample-code"><strong>Sample code</strong></h4>

<p>I have placed a complete sample of the ARM template I used for this blog, along with a parameters file and a PowerShell script to deploy it over at Github.</p>

<p>Find it in my public repository <a href="https://github.com/DanielOrneling/BlogSamples/tree/master/AutomationAccountBlogSample" target="_blank">here</a>.</p>

<h4 id="microsoft-tutorial-create-and-deploy-your-first-arm-template">Microsoft Tutorial: Create and deploy your first ARM template</h4>

<p>If you´d like to, you could also check this tutorial out that Microsoft has created on how to create and deploy your first ARM template. It will guide you from the start to the finish line where you have deployed your first template. Find the tutorial <a href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-tutorial-create-first-template?tabs=azure-powershell" target="_blank">here</a>.</p>

<h3 id="summary"><strong>Summary</strong></h3>

<p>As I´ve shown here, it doesn’t have to be that big of deal to get going with ARM templates and JSON. There are tools out there to help, so use them just as everyone else. The extensions itself won´t help you understand the JSON language, but along the way you will get a grasp of it and hopefully you will have that aha feeling, just like I did when I was learning JSON.</p>

<p>I will go through the area of ARM templates even more and tell more about what can be done, such as skipping hard-coded names etc. in upcoming posts. If you like the post or have questions, please leave a comment below and I´ll get back as soon as possible.</p>]]></content><author><name>Daniel Örneling</name></author><category term="arm-templates" /><category term="azure" /><category term="orneling-se" /><category term="armtemplates" /><category term="azure" /><category term="json" /><summary type="html"><![CDATA[The first time I heard about JSON and ARM templates together with Azure in the same sentence, was in Chicago at Microsoft Ignite back in 2015. My first thought was, what are they all talking about? This was of course during the shift from Azure “classic” which was based on XML, to Azure “Resource Manager” which is based on JSON instead. As I mentioned, this was back in 2015 so nearly five years ago now, but even more important nowadays. My first experience with this new way of working with Azure was a bit of a rollercoaster, every time I grasped something, another thing showed up that made absolutely no sense at the time. Back then I looked at a lot of sample templates and practiced my copy/paste skills to build a template that was deploying the resources I wanted to deploy. The foundation Now it´s 2020 and a lot has happened in many ways, and thankfully it´s a lot easier to get started writing ARM templates with a bunch of different tools, of which of I´m going to show a few in this post. If you don´t know what an ARM template is, it´s basically a JSON file which define the objects you want to deploy, their names, types and properties. This file is then read by the Azure Resource Manager API and deployed in the exact same way each time you run it. If something already exists, it checks for changes and if there are no changes it just skips that part of the template. The base template The base template looks like below and consists of several different sections. Parameters: Can be set to a default value, with a drop-down list of allowed values (which regions you can deploy to for example) and can be changed upon deployment. Variables: Used in the resources section of the template. Can be a combination of several parameters, or just hard-coded values. Used to define naming standards just to mention one use case. Resources: The resources to be deployed along with it´s name, properties and tags etc. Outputs: Used to return values from the template, the endpoints of a storage account for example The base template. Getting started writing code Over the years I have come to a good understanding of ARM templates and how to write them to do the things I want them too, but it hasn´t been easy. To help you get started, I want to recommend those tools I use in my work with ARM templates to make things and life in general a lot easier. And it also saves a lot of time. With these tools I´m about to recommend I can build a new ARM template to deploy a new automation account or a Log Analytics workspace in about five minutes, and that´s with some tweaking of the naming etc. The first tool I recommend using as the foundation is Visual Studio Code, which is an awesome tool to write code. I use it to write PowerShell, JSON and also YAML (for my home automation). If you haven´t tried it yet, download it here to get started. A pro tip is to create a new file and just saving it as “new-file.json” or .ps1 for example, just keep the “” when you save it. VS Code will then recognize it´s either a JSON file or a PowerShell script, and highlight the script in a correct and easy-to-work-with way. Visual Studio Code Extensions Azure Resource Manager (ARM) Tools This is the first extension to install when looking at writing ARM templates using VS Code. With this extension, VS Code understands Azure Resource Manager deployment template files. It also helps pointing out sections where the JSON code is faulty. With this extension you get some snippets to start building your templates. Just type arm! in a json file and you will get to choose from the below snippets. arm! - Adds the framework for a full deployment template file for resource group deployments arm!s - Adds the framework for a full deployment template file for subscription deployments arm!mg - Adds the framework for a full deployment template file for management group deployments arm!t - Adds the framework for a full deployment template file for tenant deployments armp! - Adds the framework for a full deployment template parameters file Download the extension from Visual Studio Marketplace here, or from within VS Code directly (see below), from the Extensions section. At the extension page, you can also see all the snippets available. The extensions pane of VS Code Azure Resource Manager Snippets When I said I can write a new template in five minutes, I am relying on an extension written by MVP Sam Cogan. It´s by far the extension I have had the most use of so far. It consists of a bunch of snippets which lets you deploy the resources you want. All you have to do is to launch a new json file and start typing “arm-“ and the snippets will show up and you can choose whichever you would like to use. Start with a Skeleton ARM Template (provided by the first extension above) and you will get the content shown above, ready to be filled up with different parameters and resources etc. It can also help you write the parameters necessary. Find a complete sample template further down in the article. Download the extension here or through VS Code Extensions as shown above. Some of the available snippets ARM Params Generator The next extension on my list is one that helps generating a parameters file. This file is used to point out the custom values that are to be changed upon deployment and consists of only a parameters section with the different values. Once you have created your ARM template and have installed this extension, just right click somewhere in the code section and choose “Azure ARM: Generate parameters file”, and it will create a file named “templatename.parameters.json”. See below what it looks like. Generate a parameters file for your ARM template The parameters file. Find the source code further down. Download the extension here or through VS Code Extensions as shown above. JSONLint The last tip for the day is a web site helping you validate your JSON code. It points you to where you need to check your code, which have saved me numerous times since it´s really easy to miss an indentation or a parenthesis or whatever when writing code. Find the JSON validator here and remember to bookmark it, cause you will need it. Sample code I have placed a complete sample of the ARM template I used for this blog, along with a parameters file and a PowerShell script to deploy it over at Github. Find it in my public repository here. Microsoft Tutorial: Create and deploy your first ARM template If you´d like to, you could also check this tutorial out that Microsoft has created on how to create and deploy your first ARM template. It will guide you from the start to the finish line where you have deployed your first template. Find the tutorial here. Summary As I´ve shown here, it doesn’t have to be that big of deal to get going with ARM templates and JSON. There are tools out there to help, so use them just as everyone else. The extensions itself won´t help you understand the JSON language, but along the way you will get a grasp of it and hopefully you will have that aha feeling, just like I did when I was learning JSON. I will go through the area of ARM templates even more and tell more about what can be done, such as skipping hard-coded names etc. in upcoming posts. If you like the post or have questions, please leave a comment below and I´ll get back as soon as possible.]]></summary></entry><entry><title type="html">New challenges on the horizon</title><link href="https://blog.orneling.se/2020/03/new-challenges-on-the-horizon" rel="alternate" type="text/html" title="New challenges on the horizon" /><published>2020-03-02T00:00:00+01:00</published><updated>2020-03-02T00:00:00+01:00</updated><id>https://blog.orneling.se/2020/03/new-challenges-on-the-horizon</id><content type="html" xml:base="https://blog.orneling.se/2020/03/new-challenges-on-the-horizon"><![CDATA[<p>A lot has happened since my last blog post, and my motivation to write new blog posts has not really been on top. Due to the fact that my personal focus has not aligned with the company for some time now So that´s why I´m now being able to write this post about this new chapter in life.</p>

<h4 id="the-past">The past</h4>

<p>I´ve been doing SCOM for about 9 years now and it´s time for a change. I have retired from Approved after about 3 years. There I was working almost 100% of the time with SCOM. There was a lot of really nice projects, and it has been a great time there. But since my personal focus has been with Azure for quite some time now I needed a change. With this shifting personal focus I thought it was time to look around for new openings.
<!--More--></p>
<h4 id="the-future">The future</h4>

<p>As of today I am working for <a href="https://addpro.se/" target="_blank">AddPro</a> as a Senior Consultant where I will focus on Azure Infrastructure instead. With the change of employer comes a change in the focus of this blog as I move on from SCOM. I will not write more about SCOM unless it´s directly connected to a subject I´m writing about of course.</p>

<h4 id="shifting-focus-of-the-blog">Shifting focus of the blog</h4>

<p>From now on I will publish Azure related articles here instead. I will share a lot of different things from how to get started using ARM templates to creating custom monitoring in Azure Monitor just to mention a few of the ideas I have.</p>

<p>I hope you stay with me on this journey and continue reading the blog. It goes without saying of course, but all the SCOM articles will remain intact on the blog as many of them still helps people on a daily basis.</p>

<p>If you have any comments or questions, feel free to drop a comment below and I´ll get back ASAP.</p>]]></content><author><name>Daniel Örneling</name></author><category term="orneling-se" /><category term="azure" /><category term="azure-monitor" /><category term="new-challenges" /><category term="new-job" /><category term="scom" /><summary type="html"><![CDATA[A lot has happened since my last blog post, and my motivation to write new blog posts has not really been on top. Due to the fact that my personal focus has not aligned with the company for some time now So that´s why I´m now being able to write this post about this new chapter in life. The past I´ve been doing SCOM for about 9 years now and it´s time for a change. I have retired from Approved after about 3 years. There I was working almost 100% of the time with SCOM. There was a lot of really nice projects, and it has been a great time there. But since my personal focus has been with Azure for quite some time now I needed a change. With this shifting personal focus I thought it was time to look around for new openings.]]></summary></entry><entry><title type="html">Azure Governance – What´s that and why should I care?</title><link href="https://blog.orneling.se/2019/11/azure-governance-whats-that-and-why-should-i-care" rel="alternate" type="text/html" title="Azure Governance – What´s that and why should I care?" /><published>2019-11-08T00:00:00+01:00</published><updated>2019-11-08T00:00:00+01:00</updated><id>https://blog.orneling.se/2019/11/azure-governance-whats-that-and-why-should-i-care</id><content type="html" xml:base="https://blog.orneling.se/2019/11/azure-governance-whats-that-and-why-should-i-care"><![CDATA[<p>Ever since Azure was a new thing and before it “went live”, we´ve been fed with how easy it is to get started using different services. One of my first experiences were when I deployed my blog on to the Azure platform somewhere back in 2012, and I was up and running in literally less than fifteen minutes, and this was the first time I did it which is why it took that long a time. It was just as simple as picking a Wordpress instance from the gallery and deploying it. A similar experience was when I deployed my first virtual machine. A few clicks and a short time for the deployment and I had my new virtual machine ready to connect to.
<!--More--></p>
<h4 id="the-evolution-of-azure">The evolution of Azure</h4>

<p>Sure, that was easy and something anyone could do, but was it the right way? Since 2012 when these events occurred, a lot has happened with Azure, and I really mean a lot! The most important change is that we´ve gone from Azure “Classic” to Azure Resource Manager (ARM), where the first generation of Azure were built upon XML, while the second generation is built upon JSON. That and a lot of other possibilities, such as the use of Rescource Groups make it more complex, but at the same time a more mature and safer experience using Azure. The right way to deploy new resources nowadays is to use ARM templates, which is a JSON formatted template telling what to deploy and how to configure it. The advantage of this is that every time you´re deploying something using the template it will be deployed the exact same way, eliminating the human factor.</p>

<h4 id="the-easy-way-vs-the-right-way"><strong>The easy way vs. the right way</strong></h4>

<p>I´ve mentioned how easy it is to get started, but does that mean it’s the right way to do it? Nope, not necessarily. Just as were used to from our on-prem environments, there´s this thing called best-practice to take into consideration. More possibilities also mean we must think our deployments through a lot more. I mentioned resource groups earlier which gives us the ability to split our deployments into several different resource groups, all which can be provided with their own sets of rights assignments.</p>

<p>While we deploy more and more resources, there are another huge thing to remember, Azure Governance, which lets us control our Azure based environment using policies to control how it´s being both deployed but also managed.</p>

<h4 id="azure-governance---the-right-way">Azure Governance - The right way</h4>

<p>Azure governance consists of three mayor areas, Management Groups, Policies and Blueprints (more about this in a later post). Just as we have Group Policy on-prem, this is our way of controlling the environment in the cloud. Management Groups let us group several different subscriptions to make it able to mirror the organization. For example, you can assign one subscription to the HR department, and others for the dev team such as a Dev and Staging environment. This makes it easy to follow up on which parts of the organization spends the most money, but that’s not the only advantage this bring. We can also assign policies subscription-wide and use access control based on our preferences.</p>

<p>With policies comes the ability to control how the environment should behave and if we have any requirements about how a resource should be equipped.</p>

<p>Below are just a few already made policies which involves virtual machines. Should you not find anything of your liking, you can always create your own policies.</p>

<p><img src="https://blog.orneling.se/assets/images/2019/11/governance-1.jpg" alt="" /></p>

<h4 id="azure-policy--the-way-to-keep-the-control"><strong>Azure Policy – The way to keep the control</strong></h4>

<p>With Azure Policy we can assign several policies and we can choose if they should just be auditing or forcing. The difference is that a policy that audits does nothing with the resource, it just audits and reports it back for us to know about, while a forcing policy actively denies certain configurations or won’t let you continue until certain requirements are met.</p>

<p>A few examples of what a policy can achieve:</p>

<ul>
  <li>Enforce the use of tags for our resources making some tags mandatory, such as cost place, business unit or environment</li>
  <li>Specifying which VM sizes can be used when deploying new servers</li>
  <li>Allowing certain regions only for resources to be deployed (extra useful when the company spans over different countries or continents)</li>
  <li>Enforcing a naming policy</li>
  <li>Installing an extension to all new servers, connecting it to Azure Monitor for example</li>
</ul>

<h4 id="enforcing-a-monitoring-policy-to-all-servers"><strong>Enforcing a monitoring policy to all servers</strong></h4>

<p>The last example mentioned above is something I want to spend some more time elaborating. We´re (hopefully) already used to monitoring our on-prem environment using System Center Operations Manager for example, but most often this tool isn’t used to monitor cloud resources other than IaaS VM´s from time to time, but now we need to be monitoring our cloud resources as well to keep the environment safe and running.</p>

<p>To make sure our resources are being monitored we can assign a policy that forces the installation of the Log Analytics monitoring agent for all servers that are deployed in the subscription. This can be configured to take effect subscription-wide or for certain resource groups only. This means that if a user deploys a server from an ARM template that don’t include the Log Analytics agent extension, this will be automatically deployed afterwards, ensuring our resources are being monitored the way we intend to, in a certain workspace.</p>

<p>I assigned this policy to my subscription, deployed two servers as seen below, “EU-SE-VM0001” and “NA-US-VM0001” and in about twenty minutes they had the Log Analytics agent installed, just as intended.</p>

<p><img src="https://blog.orneling.se/assets/images/2019/11/governance-2.jpg" alt="" /></p>

<p>And just to verify that the servers are communicating with Azure Monitor (of which Log Analytics is a part) I ran this simple query seen below to collect the information about the server’s heartbeats and their IP address along with the country they are deployed.</p>

<p><img src="https://blog.orneling.se/assets/images/2019/11/governance-3.jpg" alt="" /></p>

<p>Yes, the SE VM is based in Ireland but that´ll change once the Azure datacenter in Sweden opens.</p>

<h4 id="learn-more-about-azure-monitor-in-these-posts">Learn more about Azure Monitor in these posts:</h4>

<ul>
  <li><a href="https://blog.orneling.se/2019/06/get-notified-on-azure-service-health-issues" target="_blank">Get notified on Azure service health issues</a></li>
  <li><a href="https://blog.orneling.se/2019/06/looking-at-the-available-azure-monitor-data-sources" target="_blank">Looking at the available Azure Monitor data sources</a></li>
  <li><a href="https://blog.orneling.se/2019/05/azure-monitor-getting-started-with-alerting" target="_blank">Azure Monitor – Getting started with alerting</a></li>
  <li><a href="https://blog.orneling.se/2019/05/migrating-lots-of-agents-to-azure-log-analytics" target="_blank">Migrating lots of agents to Azure Log Analytics</a></li>
</ul>

<h4 id="so-how-can-i-azure-governance-in-my-environment"><strong>So how can I Azure Governance in my environment?</strong></h4>

<p>There´s no short answer to that. You can either use a single policy or multiple policies, where the latter is the recommendation to make sure you take good care of your resources. Earlier this week during Microsoft Ignite in Orlando, Microsoft announced Azure ARC which is a tool that you can use to manage all your resources “the Azure way” no matter where they´re deployed. This means that even if your resource is deployed in AWS, Google Cloud or on-prem, you can still use ARM templates and policies like the one above installing agents for those resources. Azure ARC is still the new kid on the block, but I have a feeling we will hear a lot about it soon and I´m pretty sure it will come to great use.</p>

<p>It also helps big time in controlling the environment and keeping it safe even with those resources that aren´t deployed in Azure, and we can keep control of them in one place instead of several different portals and tools.</p>

<p>If you want to read more about Azure ARC, you can do so <a href="https://azure.microsoft.com/en-us/services/azure-arc/" target="_blank">here</a>.</p>

<h4 id="summary"><strong>Summary</strong></h4>

<p>With this post I have started scraping the surface when it comes to Azure Governance and I´m no way near showing it all off since there’s really a lot to show in this area. It´s really important to invest in this area since it´s about securing our cloud resources, especially when more and more investments are being made in the cloud. With all the new resources being deployed, there´s a bigger need for tagging and RBAC (access control) etc. and all that can be pretty easily controlled using policies and placing them in different management groups.</p>

<p>I will keep digging in to this area of Azure Governance and instead of doing one mayor post I´ll write several covering different scenarios instead so keep your eyes open if you think this seems interesting.</p>

<p>If you have any questions, leave a comment below and I´ll get back to you.</p>]]></content><author><name>Daniel Örneling</name></author><category term="automation" /><category term="azure" /><category term="azure-monitor" /><category term="log-analytics" /><category term="microsoft-ignite" /><category term="orneling-se" /><summary type="html"><![CDATA[Ever since Azure was a new thing and before it “went live”, we´ve been fed with how easy it is to get started using different services. One of my first experiences were when I deployed my blog on to the Azure platform somewhere back in 2012, and I was up and running in literally less than fifteen minutes, and this was the first time I did it which is why it took that long a time. It was just as simple as picking a Wordpress instance from the gallery and deploying it. A similar experience was when I deployed my first virtual machine. A few clicks and a short time for the deployment and I had my new virtual machine ready to connect to.]]></summary></entry></feed>