<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>azure on The Cloud Hub</title>
    <link>https://thecloudhub.com/category/azure/</link>
    <description>Recent content in azure on The Cloud Hub</description>
    <generator>Hugo -- 0.118.2</generator>
    <language>en-au</language>
    <lastBuildDate>Fri, 14 Jul 2023 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://thecloudhub.com/category/azure/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Microsoft Azure AD to become Microsoft Entra ID</title>
      <link>https://thecloudhub.com/2023/07/14/microsoft-azure-ad-to-become-microsoft-entra-id/</link>
      <pubDate>Fri, 14 Jul 2023 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2023/07/14/microsoft-azure-ad-to-become-microsoft-entra-id/</guid>
      <description>Microsoft has this week revealed that by the end of 2023, Azure AD will be known as Entra ID, joining the other identity products already in the Entra suite.
In a post on the Microsoft blog, Joy Chik, President, Identity &amp;amp; Network Access said that Entra ID will join Entra Permissions Management, Entra Verified ID, Entra ID Governance and Entra Workload ID.
&amp;ldquo;To simplify our product naming and unify our product family, we’re changing the name of Azure AD to Microsoft Entra ID,&amp;rdquo; Chik wrote.</description>
      <content:encoded><![CDATA[<p>Microsoft has this week revealed that by the end of 2023, Azure AD will be known as Entra ID, joining the other identity products already in the Entra suite.</p>
<p>In <a href="https://www.microsoft.com/en-us/security/blog/2023/07/11/microsoft-entra-expands-into-security-service-edge-and-azure-ad-becomes-microsoft-entra-id/">a post</a> on the Microsoft blog, Joy Chik, President, Identity &amp; Network Access said that Entra ID will join Entra Permissions Management, Entra Verified ID, Entra ID Governance and Entra Workload ID.</p>
<p>&ldquo;To simplify our product naming and unify our product family, we’re changing the name of Azure AD to Microsoft Entra ID,&rdquo; Chik wrote.</p>
<p>&ldquo;Capabilities and licensing plans, sign-in URLs, and APIs remain unchanged, and all existing deployments, configurations, and integrations will continue to work as before.&rdquo;</p>
<p>Customers will begin to notice the rebrand start to roll out across Azure from today, as well as updates to documentation and on Microsoft materials.</p>
<p>Customers are not required to make any changes as a result of this announcement, though partners and resellers are advised to start updating marketing materials and replacing references to Azure AD.</p>
<p>Alongside the announcement, Microsoft also announced a preview of a new web security gateway called <a href="https://aka.ms/internetaccess">Entra Internet Access</a>. Designed to protect access to software-as-a-service (SaaS) products and internet resources, the product takes conditional access policies one step further.</p>
<p>A second product was also revealed in preview, dubbed <a href="https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-private-access">Entra Private Access</a>. This product allows customers to connect to private apps no matter what network they&rsquo;re on or where they&rsquo;re located. It allows organisations to replace traditional, legacy VPNs and provides more granular conditional access policies.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Getting started with Azure Policies</title>
      <link>https://thecloudhub.com/2022/12/12/getting-started-with-azure-policies/</link>
      <pubDate>Mon, 12 Dec 2022 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2022/12/12/getting-started-with-azure-policies/</guid>
      <description>Once you start adopting a cloud service such as Microsoft Azure, one of the first tasks should be looking at how to enforce organisational and best-practice policies at scale when resources are being created.
Fortunately Microsoft makes enforcing policies relatively straightforward via a service called Azure Policy. It combines a number of best practice, out-of-the-box policies with the ability for you to also create your own custom policy definitions. You can setup guardrails and enforce compliance easily.</description>
      <content:encoded><![CDATA[<p>Once you start adopting a cloud service such as Microsoft Azure, one of the first tasks should be looking at how to enforce organisational and best-practice policies at scale when resources are being created.</p>
<p>Fortunately Microsoft makes enforcing policies relatively straightforward via a service called <a href="https://azure.microsoft.com/en-au/pricing/details/azure-policy/#overview">Azure Policy</a>. It combines a number of best practice, <a href="https://learn.microsoft.com/en-us/azure/governance/policy/samples/built-in-policies">out-of-the-box policies</a> with the ability for you to also create your own custom policy definitions. You can setup guardrails and enforce compliance easily.</p>
<p>The best bit? Aside from Azure Arc resources, Azure Policy is available <a href="https://azure.microsoft.com/pricing/details/azure-policy/#overview">free of charge</a>.</p>
<h3 id="setting-up-policies">Setting up policies</h3>
<p>Once you have an active Azure subscription, the first thing you&rsquo;ll want to do is sign in to the <a href="https://portal.azure.com">Azure portal</a> and open the &lsquo;Policy&rsquo; service. You can find this by searching for &lsquo;Policy&rsquo;.</p>
<p>If you haven&rsquo;t setup any policies and you have no provisioned resources, you should see a dashboard showing a 100% compliance rate. Otherwise the dashboard may show you issues that require attention with your provisioned resources.</p>
<p>The &lsquo;Getting Started&rsquo; tab allows you to quickly setup policy assignments for your cloud environment. This includes things such as blocking the provision of various resource types or requiring tags on resources.</p>
<!-- raw HTML omitted -->
<p><img loading="lazy" src="images/getting-started-azure-policy-1024x612.png" alt=""  />
</p>
<!-- raw HTML omitted -->
<p>The &lsquo;Getting Started&rsquo; tab for Azure Policy</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>Alternatively you can select &ldquo;Definitions&rdquo; under &ldquo;Authoring&rdquo; and browse the complete list of policy definitions that can be applied.</p>
<p>Before configuring a policy, consider whether you want to retrospectively apply a policy to existing Azure resources or whether it should only apply to <em>new</em> resources being provisioned.</p>
<p>By default policies only apply to new resources, but you can update existing resources after the policy has been assigned.</p>
<p>Once you select a policy, you can configure the following:</p>
<ul>
<li>
<p><strong>Scope</strong>: The tenant, management group, subscription (optional) and resource group (optional) that the policy will apply to</p>
</li>
<li>
<p><strong>Basics</strong>: The policy definition, assignment name and brief description of the policy. You can also specify whether the policy is enforced or disabled, and see who assigned the policy</p>
</li>
<li>
<p><strong>Parameters</strong>: Some policies may require additional parameters. For example, the &lsquo;Not allowed resource types&rsquo; policy requires you to select the types of resources you want to prohibit from being provisioned</p>
</li>
<li>
<p><strong>Remediation</strong>: If you&rsquo;re deploying a policy with the <code>deployIfNotExists</code> and modify effect types you&rsquo;ll need to provide a managed identity that can be used to edit tags and deploy resources where required. You may also need to configure role permissions</p>
</li>
<li>
<p><strong>Non-compliance message</strong>: Message to show when a resource or modification is denied due to the policy, or if a resource is presently non-compliant</p>
</li>
</ul>
<!-- raw HTML omitted -->
<p><img loading="lazy" src="images/azure-policy-parameters-910x1024.png" alt=""  />
</p>
<!-- raw HTML omitted -->
<p>Where needed, provide Azure policy parameters</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h3 id="monitoring-compliance">Monitoring compliance</h3>
<p>Once you&rsquo;ve configured your policies, the &ldquo;Compliance&rdquo; tab will update to show resources and their compliance state.</p>
<p>The list of resources shown can be filtered by scope (management group, subscription, resource group or resource type), definition type (all, initiative or policy), compliance state (such as compliant, non-compliant, not registered) and by name or ID.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Guide to Azure DevOps certification</title>
      <link>https://thecloudhub.com/2021/11/10/guide-to-azure-devops-certification/</link>
      <pubDate>Wed, 10 Nov 2021 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2021/11/10/guide-to-azure-devops-certification/</guid>
      <description>Are you looking to become certified in Azure DevOps? If so, read on to find out more about what official Microsoft certifications are available.
The pathway to Azure DevOps certification The first certification you&amp;rsquo;ll want to get is for Azure Fundamentals (AZ-900). This covers the basics about Azure, including generic cloud concepts as well as more targeted Azure information such as pricing and a high-level overview of available services.
Note that the content for Fundamentals changed on October 25, 2021 so you might want to check the skills measured list to ensure you&amp;rsquo;re still studying the right materials.</description>
      <content:encoded><![CDATA[<p>Are you looking to become certified in Azure DevOps? If so, read on to find out more about what <a href="https://docs.microsoft.com/en-us/learn/certifications/roles/devops-engineer">official Microsoft certifications are available</a>.</p>
<h2 id="the-pathway-to-azure-devops-certification">The pathway to Azure DevOps certification</h2>
<p>The first certification you&rsquo;ll want to get is for <a href="https://docs.microsoft.com/en-us/learn/certifications/azure-fundamentals/">Azure Fundamentals</a> (AZ-900). This covers the basics about Azure, including generic cloud concepts as well as more targeted Azure information such as pricing and a high-level overview of available services.</p>
<p>Note that the content for Fundamentals changed on October 25, 2021 so you might want to check <a href="https://docs.microsoft.com/en-us/learn/certifications/exams/az-900">the skills measured list</a> to ensure you&rsquo;re still studying the right materials.</p>
<p>Once you&rsquo;ve completed the Fundamentals course, you should target either the <a href="https://docs.microsoft.com/en-us/learn/certifications/azure-administrator/">Azure Administrator Associate</a> (AZ-104) or <a href="https://docs.microsoft.com/en-us/learn/certifications/azure-developer/">Azure Developer Associate</a> (AZ-204) exam.</p>
<p>These will give you a solid understanding of core Azure services, and how to put in place best practice solutions to meet the needs of your organisation.</p>
<p>Finally you can undertake the <a href="https://docs.microsoft.com/en-us/learn/certifications/devops-engineer/">DevOps Engineer Expert certification (AZ-400)</a>, which will entail both hands-on lab work as well as an exam. Note that the content for this course changes on November 30, 2021.</p>
<p>AZ-400 requires you to have completed either AZ-104 or AZ-204 before you can attempt the exam.</p>
<h2 id="conclusion">Conclusion</h2>
<p>In summary, there&rsquo;s a clear pathway to becoming a certified Azure DevOps engineer.</p>
<p>While it will take time, and a lot of hard work - now that Microsoft have role-based certifications in place it&rsquo;s much easier to work out what exams you need to sit to be considered an expert in your field.</p>
]]></content:encoded>
    </item>
    <item>
      <title>How to query multiple Azure Application Insights instances at once</title>
      <link>https://thecloudhub.com/2021/10/27/how-to-query-multiple-azure-application-insights-instances-at-once/</link>
      <pubDate>Wed, 27 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2021/10/27/how-to-query-multiple-azure-application-insights-instances-at-once/</guid>
      <description>Do you have multiple Azure Application Insights instances that you&amp;rsquo;d like to query at once? Perhaps you&amp;rsquo;re trying to see all errors across multiple environments, each with their own App Insights instance?
When using the Azure Portal, querying multiple instances is straightforward.
How to query across multiple App Insight instances
First, login to the Azure portal using your Microsoft work, school or personal account credentials.
Navigate to one of the App Insight instances you&amp;rsquo;d like to run a query against.</description>
      <content:encoded><![CDATA[<p>Do you have multiple Azure Application Insights instances that you&rsquo;d like to query at once? Perhaps you&rsquo;re trying to see all errors across multiple environments, each with their own App Insights instance?</p>
<p>When using the Azure Portal, querying multiple instances is straightforward.</p>
<p><strong>How to query across multiple App Insight instances</strong></p>
<p>First, login to the <a href="https://portal.azure.com">Azure portal</a> using your Microsoft work, school or personal account credentials.</p>
<p>Navigate to one of the App Insight instances you&rsquo;d like to run a query against.</p>
<p>Then, in the sidebar scroll down until you see &lsquo;Logs&rsquo;. Click on this menu item.</p>
<!-- raw HTML omitted -->
<p><img loading="lazy" src="images/app_insights_logs-1024x534.png" alt=""  />
</p>
<!-- raw HTML omitted -->
<p>Application Insights logging screen</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>You should now see the Application Insights query screen. From here, click &lsquo;Select scope&rsquo;.</p>
<!-- raw HTML omitted -->
<p><img loading="lazy" src="images/select_app_insights_scope-1024x463.png" alt=""  />
</p>
<!-- raw HTML omitted -->
<p>Application Insights scope selector</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<p>A new modal will appear, allowing you to select multiple Application Insights instances to run your query against from through out your subscription and across multiple resource groups.</p>
<p>Once you&rsquo;ve clicked the checkbox next to your selected Application Insights instances, click &lsquo;Apply&rsquo; to close the modal and persist your selection.</p>
<p>Now type your query, and click &lsquo;Run&rsquo;. It will execute the request against all your selected scopes (in this case your Application Insights instances) and return the results.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Getting started with Azure Bicep</title>
      <link>https://thecloudhub.com/2021/03/24/getting-started-with-bicep-for-azure/</link>
      <pubDate>Wed, 24 Mar 2021 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2021/03/24/getting-started-with-bicep-for-azure/</guid>
      <description>Bicep is a new language from Microsoft that allows you to easily specify your Azure infrastructure as code.
It&amp;rsquo;s an improvement on writing Azure Resource Manager (ARM) templates directly by better supporting features such as type safety and code modularity and reuse.
That said, Bicep still has a very close relationship with ARM templates. In fact, it&amp;rsquo;s an abstraction over ARM templates with templates written using Bicep able to be transpiled back to ARM templates.</description>
      <content:encoded><![CDATA[<p>Bicep is a new language from Microsoft that allows you to easily specify your Azure infrastructure as code.</p>
<p>It&rsquo;s an improvement on writing Azure Resource Manager (ARM) templates directly by better supporting features such as type safety and code modularity and reuse.</p>
<p>That said, <a href="https://github.com/azure/bicep">Bicep</a> still has a very close relationship with ARM templates. In fact, it&rsquo;s an abstraction over ARM templates with templates written using Bicep able to be transpiled <em>back</em> to ARM templates. And if you have a bunch of existing ARM templates, they can be transpiled and converted <em>into</em> Bicep files.</p>
<p>Let&rsquo;s now take a look at how you can get started using Bicep.</p>
<h2 id="preparing-your-environment">Preparing your environment</h2>
<p>There&rsquo;s a few things you&rsquo;ll want to install in order to start using Bicep.</p>
<p>First you&rsquo;ll want to download <a href="https://code.visualstudio.com">Visual Studio Code</a> (free) and install the Bicep extension (also free). This will give you an editor in which to write your Bicep files, and the extension adds handy features such as Intellisense code suggestions and template validation to ensure the correct syntax.</p>
<p>You&rsquo;ll also need to install the Bicep command line interface (CLI). The easiest, cross-platform way to do this is by installing the <a href="https://docs.microsoft.com/en-us/cli/azure/install-azure-cli">Azure command line interface</a>. But if you&rsquo;re after an alternative, see <a href="https://github.com/Azure/bicep/blob/main/docs/installing.md">this list</a>.</p>
<h2 id="become-a-bicep-guru">Become a Bicep guru</h2>
<p>Dive deeper into Bicep with our getting started with Bicep course on Udemy today!</p>
<p><a href="https://www.udemy.com/course/azure-bicep/?referralCode=C607A504E006C9FB1B32">Start learning</a></p>
<h2 id="writing-your-first-bicep-file">Writing your first Bicep file</h2>
<p>Open Visual Studio Code, and create a new file called <code>HelloWorld.bicep</code>. In it, paste the following code:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">6
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">7
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>resource appConfig &#39;Microsoft.AppConfiguration/configurationStores@2020-06-01&#39; = {
</span></span><span style="display:flex;"><span>  name: &#39;bicepDemoAppConfig&#39;
</span></span><span style="display:flex;"><span>  location: &#39;westus2&#39;
</span></span><span style="display:flex;"><span>  sku: {
</span></span><span style="display:flex;"><span>    name: &#39;standard&#39;
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></td></tr></table>
</div>
</div><p>In this template, we&rsquo;re creating an <a href="https://azure.microsoft.com/en-us/services/app-configuration/">App Configuration service</a> in Azure. Lets breakdown the template:</p>
<p><code>appConfig</code> provides a local resource name for use within the template if you need to refer to this resource as a dependency, or from within another resource.</p>
<p><code>Microsoft.AppConfiguration/configurationStores@2020-06-01</code> refers to the resource type and the values that can be configured. See <a href="https://docs.microsoft.com/en-us/azure/templates/">this Microsoft documentation</a> for a full list of resource types.</p>
<p>As such, <code>name</code>, <code>location</code> and <code>sku</code> are all values that can be set for the resource type.</p>
<h2 id="next-steps">Next steps</h2>
<p>To learn how to deploy this template, or to find out about more advanced Bicep topics including for loops, conditional statements and modularised templates <a href="https://www.udemy.com/course/azure-bicep/?referralCode=C607A504E006C9FB1B32">check out our Udemy course on getting started with Bicep</a>.</p>
]]></content:encoded>
    </item>
    <item>
      <title>How to create an Azure app service with a database</title>
      <link>https://thecloudhub.com/2021/01/27/how-to-create-an-azure-app-service-with-a-database/</link>
      <pubDate>Wed, 27 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2021/01/27/how-to-create-an-azure-app-service-with-a-database/</guid>
      <description>Need to deploy your app to an Azure app service, and rely on a database such as Postgres or Azure SQL?
Microsoft is now previewing a new blade in the Azure portal that lets you quickly spin up an Azure app service with an associated database.
Supported database engines for the preview are Postgres or serverless Azure SQL server.
To get started using the new blade, click here or search the Azure Marketplace for &amp;ldquo;web app database&amp;rdquo;.</description>
      <content:encoded><![CDATA[<p>Need to deploy your app to an Azure app service, and rely on a database such as Postgres or Azure SQL?</p>
<p>Microsoft is <a href="https://portal.azure.com/?feature.customportal=false#create/Microsoft.AppServiceWebAppDatabaseV3">now previewing a new blade</a> in the Azure portal that lets you quickly spin up an Azure app service with an associated database.</p>
<p>Supported database engines for the preview are Postgres or serverless Azure SQL server.</p>
<p>To get started using the new blade, <a href="https://portal.azure.com/?feature.customportal=false#create/Microsoft.AppServiceWebAppDatabaseV3">click here</a> or search the Azure Marketplace for &ldquo;web app database&rdquo;.</p>
<p>The blade - currently in preview - is fairly basic compared to the normal app service blade, but allows you to specify the app name, runtime and database engine. You can also set the server name and database name.</p>
<p>By default it&rsquo;ll spin up an app service using the Premium V2 tier, but you can scale this down (or up if required) once the service is created using the regular Azure scale up settings.</p>
<p>The database connection information will automatically be set as environment variables for your app service.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Creating your first Azure Resource Manager (ARM) template</title>
      <link>https://thecloudhub.com/2020/02/27/creating-your-first-azure-resource-manager-arm-template/</link>
      <pubDate>Thu, 27 Feb 2020 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2020/02/27/creating-your-first-azure-resource-manager-arm-template/</guid>
      <description>If you’re manually creating infrastructure for your next app in Azure, you should consider using an Azure Resource Manager (ARM) template.
An ARM template is essentially a JSON file that describes the infrastructure you want to create in the Azure cloud. It can be run as many times as you like to spin up identically-configured environments.
Create the template The first step when using an ARM template is to create the template file.</description>
      <content:encoded><![CDATA[<p>If you’re manually creating infrastructure for your next app in Azure, you should consider using an Azure Resource Manager (ARM) template.</p>
<p>An ARM template is essentially a JSON file that <em>describes</em> the infrastructure you want to create in the Azure cloud. It can be run as many times as you like to spin up identically-configured environments.</p>
<h2 id="create-the-template">Create the template</h2>
<p>The first step when using an ARM template is to create the template file. If you’d rather start with an example template, Microsoft has <a href="https://github.com/Azure/azure-quickstart-templates">an entire Github repo</a> with some templates that you can clone.</p>
<p>The base template - normally called <code>azuredeploy.json</code> - is made up of the following structure:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  “$schema”: “https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#”,
</span></span><span style="display:flex;"><span>  “ContentVersion”: “1.0.0.0”,
</span></span><span style="display:flex;"><span>  “Resources”: []
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></td></tr></table>
</div>
</div><p>The elements can be described as follows:</p>
<ul>
<li><strong>$schema:</strong> Refers to the properties that can be used within the template. If you were to load the URL in your web browser, it would return the elements and a description of each that you can use within your template. When uploading a template, these get validated to ensure you haven’t made any mistakes.</li>
<li><strong>contentVersion</strong>: This is an internal version number for you to use to reference the current template. It should be in the format X.X.X.X, with X being any integer. You should only change this value in your template when a significant change is made.</li>
<li><strong>resources</strong>: This is an array that will contain a description of all the Azure resources that your app or service needs. For now it’s empty.</li>
</ul>
<h2 id="add-resources-to-the-template">Add resources to the template</h2>
<p>As mentioned above, within the <code>resources</code> section of the template you need to describe the Azure services that you wish to provision. Each Azure service has a set of properties that can be set, with some mandatory. By default, a resource requires:</p>
<ul>
<li><strong>type:</strong> The type is a string that refers to a namespace of the resource provider and the name of the type of resource that you wish to provision. For example, <code>Microsoft.DocumentDB/DatabaseAccounts</code> implies you want to create a <code>DatabaseAccount</code> from the <code>Microsoft.DocumentDB</code> namespace</li>
<li><strong>apiVersion:</strong> Similar to the template <code>$schema</code> version, each Azure resource type also publishes versions of their schema. This property allows you to specify which schema or version of the resource type you’d like to use and is mandatory</li>
<li><strong>name</strong>: The human-readable string name that you’d like the resource to be called</li>
</ul>
<p>While not mandatory, a <strong>location</strong> element is normally provided as well to specify the location where you want the resource to reside (eg. <code>Australia East</code>).</p>
<p>Luckily Microsoft <a href="https://docs.microsoft.com/en-us/azure/templates/">publishes a full list of properties</a> for each resource type. But if you’re still not sure, for most resources you can manually create the resource using the Azure Portal and go to the “Export Template” tab for the resource, and Microsoft will generate a template for you.</p>
<p>For this tutorial, let’s create a <a href="https://thecloudhub.com/2019/03/create-an-azure-function-app-using-a-mac/">simple functions app</a>. Add the following to your <code>resources</code> section in your <code>azuredeploy.json</code> file:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">25
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">26
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">27
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">28
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">29
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">30
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">31
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">32
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">33
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">34
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">35
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">36
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">37
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">38
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">39
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">40
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">41
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">42
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">43
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>   &#34;resources&#34;: [
</span></span><span style="display:flex;"><span>        {
</span></span><span style="display:flex;"><span>            &#34;type&#34;: &#34;Microsoft.Web/sites&#34;,
</span></span><span style="display:flex;"><span>            &#34;apiVersion&#34;: &#34;2018-02-01&#34;,
</span></span><span style="display:flex;"><span>            &#34;name&#34;: &#34;[parameters(&#39;siteName&#39;)]&#34;,
</span></span><span style="display:flex;"><span>            &#34;kind&#34;: &#34;functionapp,linux&#34;,
</span></span><span style="display:flex;"><span>            &#34;location&#34;: &#34;[parameters(&#39;location&#39;)]&#34;,
</span></span><span style="display:flex;"><span>            &#34;dependsOn&#34;: [
</span></span><span style="display:flex;"><span>                &#34;[resourceId(&#39;Microsoft.Web/serverfarms&#39;, variables(&#39;hostingPlanName&#39;))]&#34;
</span></span><span style="display:flex;"><span>            ],
</span></span><span style="display:flex;"><span>            &#34;properties&#34;: {
</span></span><span style="display:flex;"><span>                &#34;name&#34;: &#34;[parameters(&#39;siteName&#39;)]&#34;,
</span></span><span style="display:flex;"><span>                &#34;siteConfig&#34;: {
</span></span><span style="display:flex;"><span>                     &#34;appSettings&#34;: [
</span></span><span style="display:flex;"><span>                        {
</span></span><span style="display:flex;"><span>                            &#34;name&#34;: &#34;FUNCTIONS_WORKER_RUNTIME&#34;,
</span></span><span style="display:flex;"><span>                            &#34;value&#34;: &#34;python&#34;
</span></span><span style="display:flex;"><span>                        },
</span></span><span style="display:flex;"><span>                        {
</span></span><span style="display:flex;"><span>                            &#34;name&#34;: &#34;FUNCTIONS_EXTENSION_VERSION&#34;,
</span></span><span style="display:flex;"><span>                            &#34;value&#34;: &#34;~2&#34;
</span></span><span style="display:flex;"><span>                        }
</span></span><span style="display:flex;"><span>                    ]
</span></span><span style="display:flex;"><span>                },
</span></span><span style="display:flex;"><span>                &#34;serverFarmId&#34;: &#34;[resourceId(&#39;Microsoft.Web/serverfarms&#39;, variables(&#39;hostingPlanName&#39;))]&#34;,
</span></span><span style="display:flex;"><span>                &#34;clientAffinityEnabled&#34;: false
</span></span><span style="display:flex;"><span>            }
</span></span><span style="display:flex;"><span>        },
</span></span><span style="display:flex;"><span>        {
</span></span><span style="display:flex;"><span>            &#34;type&#34;: &#34;Microsoft.Web/serverfarms&#34;,
</span></span><span style="display:flex;"><span>            &#34;apiVersion&#34;: &#34;2018-02-01&#34;,
</span></span><span style="display:flex;"><span>            &#34;name&#34;: &#34;[variables(&#39;hostingPlanName&#39;)]&#34;,
</span></span><span style="display:flex;"><span>            &#34;location&#34;: &#34;[parameters(&#39;location&#39;)]&#34;,
</span></span><span style="display:flex;"><span>            &#34;kind&#34;: &#34;linux&#34;,
</span></span><span style="display:flex;"><span>            &#34;properties&#34;:{
</span></span><span style="display:flex;"><span>                &#34;reserved&#34;: false
</span></span><span style="display:flex;"><span>            },
</span></span><span style="display:flex;"><span>            &#34;sku&#34;: {
</span></span><span style="display:flex;"><span>                &#34;Tier&#34;: &#34;Dynamic&#34;,
</span></span><span style="display:flex;"><span>                &#34;Name&#34;: &#34;Y1&#34;
</span></span><span style="display:flex;"><span>            }
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    ]
</span></span></code></pre></td></tr></table>
</div>
</div><p>The above creates a Linux App Service hosting plan. It uses the consumption function tier (Y1) and isn’t a reserved plan.</p>
<p>The template also creates a function app (<code>Microsoft.Web/sites</code>) that <code>dependsOn</code> the hosting plan.</p>
<p>If you look closely, you might notice that some elements refer to <code>variables</code> and <code>parameters</code>. Let’s dive deeper into what they are.</p>
<h2 id="what-are-parameters">What are parameters?</h2>
<p>Parameters allow you to specify a value each time you deploy a template. For example, if you had a template and wanted to create a production and staging environment with it, you could create a <code>environment</code> parameter that would allow you to specify <code>staging</code> or <code>production</code> in resource names <em>without</em> modifying the template file each time.</p>
<p>If you didn’t use a parameter, you’d need to change the hard-coded string value in your <code>azuredeploy.json</code> file each time you wanted to change to a new environment.</p>
<p>Similarly if you wanted to be able to deploy your template to a different Azure location quickly, you could specify a <code>location</code> parameter. Then you could deploy to any Azure region by simply providing a new <code>location</code> parameter value - with no change to the template file required.</p>
<p>Within the template file, parameters sit in a top-level <code>parameters</code> element as follows:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  “$schema”: “https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#”,
</span></span><span style="display:flex;"><span>  “ContentVersion”: “1.0.0.0”,
</span></span><span style="display:flex;"><span>  “Resources”: [],
</span></span><span style="display:flex;"><span>  “Parameters”: {
</span></span><span style="display:flex;"><span>    “hostingPlanName”: {
</span></span><span style="display:flex;"><span>      “type”: “string”,
</span></span><span style="display:flex;"><span>      “DefaultValue”: “”,
</span></span><span style="display:flex;"><span>      “Metadata”: {
</span></span><span style="display:flex;"><span>           “Description”: “The name to give your hosting plan”
</span></span><span style="display:flex;"><span>      }
</span></span><span style="display:flex;"><span>   }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></td></tr></table>
</div>
</div><p>Parameters support a number of elements, but the most common include:</p>
<ul>
<li><strong>type</strong>: The type of value provided (eg. String)</li>
<li><strong>defaultValue:</strong> A default value to use if one isn’t provided when the template is deployed</li>
<li><strong>metadata.description</strong>: A description of what the parameter represents</li>
</ul>
<p>Parameters can be set when deploying using the Azure CLI or PowerShell. Here’s an example of how you would provide a <code>location</code> parameter using the Azure CLI:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>az group deployment create \
</span></span><span style="display:flex;"><span>  —-name mytemplatename \
</span></span><span style="display:flex;"><span>  —-resource-group yourResourceGroup \
</span></span><span style="display:flex;"><span>  —-templateFile $templateFile \
</span></span><span style="display:flex;"><span>  —-parameters environment=staging
</span></span></code></pre></td></tr></table>
</div>
</div><p>Referencing the parameter is done using the following syntax - you can see a full example in the template we defined earlier with resources:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>&#34;location&#34;: &#34;[parameters(&#39;location&#39;)]&#34;
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="what-are-variables">What are variables?</h2>
<p>While parameters allow you to specify values when _deployin_g a template, variables allow you to reuse values internally within your template file without duplication. For instance, if you had a value that you use in 3 different resources (such as a <code>location</code> or in the example above the <code>hostingPlanName</code>) that you <em>didn’t</em> want to expose to those running your template you could use a variable.</p>
<p>Like parameters, variables are also top-level elements. They’re simpler to specify, as you don’t need to provide descriptions, types and default values. They look like this:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">6
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">7
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">8
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  “$schema”: “https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#”,
</span></span><span style="display:flex;"><span>  “ContentVersion”: “1.0.0.0”,
</span></span><span style="display:flex;"><span>  “Resources”: [],
</span></span><span style="display:flex;"><span>  “Variables”: {
</span></span><span style="display:flex;"><span>     “HostingPlanName”: “yourHostingPlanName”
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></td></tr></table>
</div>
</div><p>You can then reference the variable within your resource definitions using the following syntax as seen in the resources section in the template we created earlier:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>&#34;name&#34;: &#34;[variables(&#39;hostingPlanName&#39;)]&#34;
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="summary">Summary</h2>
<p>In this post, you’ve learnt about how a template is structured, and what each element means. Stay tuned for our next post on deploying your template.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Managed identities and Azure App Service staging slots</title>
      <link>https://thecloudhub.com/2020/01/29/managed-identities-and-azure-app-service-staging-slots/</link>
      <pubDate>Wed, 29 Jan 2020 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2020/01/29/managed-identities-and-azure-app-service-staging-slots/</guid>
      <description>If you&amp;rsquo;re using an Azure App Service on a tier that offers staging slots (standard and above) then you might want to consider what happens when you swap a slot.
If you&amp;rsquo;ve configured a slot then you&amp;rsquo;ll want to swap deployments at a minimum between a production and pre-production environment. Microsoft cover in depth what happens when you commence a swap, but what they don&amp;rsquo;t cover is what happens to any managed identities that you have setup for the app service.</description>
      <content:encoded><![CDATA[<p>If you&rsquo;re using an Azure App Service on a tier that offers staging slots (standard and above) then you might want to consider what happens when you swap a slot.</p>
<p>If you&rsquo;ve configured a slot then you&rsquo;ll want to swap deployments at a minimum between a production and pre-production environment. Microsoft cover in depth <a href="https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots#what-happens-during-a-swap">what happens when you commence a swap</a>, but what they don&rsquo;t cover is what happens to any <a href="https://thecloudhub.com/2019/03/whats-an-azure-service-principal-and-managed-identity/">managed identities</a> that you have setup for the app service.</p>
<p>In short, managed identities are tied to the slot in which you first create or assign them, and do <em>not</em> change when you initiate a swap between two or more slots.</p>
<p>You <a href="https://thecloudhub.com/2019/03/whats-an-azure-service-principal-and-managed-identity/">might recall</a> that for an App Service you can have both a system-assigned or a user-assigned identity. These are configured to allow your App Service to access other Azure resources, without the need for sharing secrets and passwords.</p>
<p>When swapping slots, both system and user-assigned identities remain tied to the slot. They don&rsquo;t swap - so if you need to change these, you&rsquo;ll need to intervene separately.</p>
<p>Once you&rsquo;ve generated or assigned an identity, don&rsquo;t forget to then add it to any Azure resources your app needs access to.</p>
<p>Also keep in mind the lifecycle of a managed identity. User assigned identities won&rsquo;t be removed whenever you delete a slot. On the other hand, system assigned identities will be deleted as soon as you delete a slot. Depending on your situation, you may prefer one of these approaches.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Azure Availability Zones vs Availability Sets</title>
      <link>https://thecloudhub.com/2019/11/09/azure-availability-zones-vs-availability-sets/</link>
      <pubDate>Sat, 09 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/11/09/azure-availability-zones-vs-availability-sets/</guid>
      <description>A common question for newcomers to Microsoft&amp;rsquo;s Azure platform is what&amp;rsquo;s the difference between an availability zone and an availability set?
An availability zone is a unique physical location within one Azure region, and provides high-availability for your application and infrastructure. Each zone is independent and has physically isolated power, cooling, and networking from other zones within the same region.
Different Azure services have varying levels of support for availability zones.</description>
      <content:encoded><![CDATA[<p>A common question for newcomers to Microsoft&rsquo;s Azure platform is what&rsquo;s the difference between an availability zone and an availability set?</p>
<p>An <strong>availability zone</strong> is a unique physical location within one Azure region, and provides high-availability for your application and infrastructure. Each zone is independent and has physically isolated power, cooling, and networking from other zones within the same region.</p>
<p>Different Azure services have varying levels of support for availability zones. Some will automatically replicate between zones, while others will require you to choose the zone to connect to.</p>
<p>Availability zones aren&rsquo;t available within all Azure regions - in fact, <a href="https://azure.microsoft.com/en-au/global-infrastructure/regions/">currently</a> there are only 10 regions across the United States, Asia and Europe that support availability zones:</p>
<ul>
<li>Central US</li>
<li>East US</li>
<li>East US 2</li>
<li>West US 2</li>
<li>North Europe</li>
<li>UK South</li>
<li>West Europe</li>
<li>France Central</li>
<li>Japan East</li>
<li>Southeast Asia</li>
</ul>
<p>On the other hand, an <strong>availability set</strong> is a concept that only applies to virtual machines. A set allows you to isolate virtual machine (VM) resources from one another when deployed, meaning your VMs will run across multiple machines and racks. This will help to avoid a hardware failure bringing down your entire application, and also means that outages from Microsoft updates won&rsquo;t cause your application issues.</p>
<p>Unlike an <strong>availability zone</strong> which applies at the data centre level, an <strong>availability set</strong> only applies within the same data centre.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Using Cloudflare with Azure Blob Storage</title>
      <link>https://thecloudhub.com/2019/09/24/using-cloudflare-with-azure-blob-storage/</link>
      <pubDate>Tue, 24 Sep 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/09/24/using-cloudflare-with-azure-blob-storage/</guid>
      <description>If you’re storing files in Azure Storage, you’ll likely soon find that the cost of bandwidth will soon become one of the more expensive items in your Azure bill. By using a content delivery network (CDN), you can improve performance for those accessing your files from around the world, while also reducing the bandwidth costs incurred on Azure.
Microsoft offers its own Azure CDN solution, or you can use Akamai or Verizon.</description>
      <content:encoded><![CDATA[<p>If you’re storing files in Azure Storage, you’ll likely soon find that the cost of bandwidth will soon become one of the more expensive items in your Azure bill. By using a content delivery network (CDN), you can improve performance for those accessing your files from around the world, while also reducing the bandwidth costs incurred on Azure.</p>
<p>Microsoft offers its own <a href="https://azure.microsoft.com/en-gb/services/cdn/">Azure CDN solution</a>, or you can use Akamai or Verizon. However, for the purposes of this tutorial we’ll be using Cloudflare - a third-party vendor who offers a free tier that should meet most people’s needs. Cloudflare can cache files based on the caching headers you apply when you upload files to blob storage, or you can apply default caching values. As a side note, Cloudflare also offers other services such as DDoS protection and edge workers.</p>
<p>Note that you’lll need to have your own domain name for this to work - you need to associate a custom domain name with the blob storage account. To use Cloudflare services, you also need to point your domain to Cloudflare’s name servers.</p>
<p><strong>Setup Cloudflare</strong><br>
If you have a Cloudflare account already, you can skip this section. Otherwise, create an account at <a href="https://cloudflare.com">Cloudflare</a>. The free account will be fine for this tutorial.</p>
<p>Once your account has been created, click “Add a site” and follow the instructions to verify and add your domain to Cloudflare. If you want to use a sub domain (eg. cdn.example.com) for the Blob Storage custom domain, this should be the root domain (eg. example.com).</p>
<p>This will also require changing your domain’s nameservers, so you’ll require admin permissions with your DNS registrar.</p>
<p><strong>Getting started</strong><br>
If you haven’t already done so, create an Azure Storage resource by clicking “Create a resource” in the Azure Portal. Search for “storage account”, and choose the Microsoft service by clicking “Create”. Fill in the settings as required for your storage account.</p>
<p>Once your account has been provisioned, head to the “Storage accounts” tab and choose the account you want to setup.</p>
<p><strong>Create a custom domain</strong><br>
The first step in setting up Cloudflare with Blob Storage is to map it to a custom domain name that you own (such as example.com). In the Azure Portal for your storage account, go to “Custom domain” under the “Blob service” tab.</p>
<p>You should see some Microsoft instructions about configuring a CNAME record with your DNS provider, which should now be Cloudflare. Follow these steps first, by logging into your Cloudflare account and adding the CNAME record to validate your ownership of the domain with Microsoft. Note that this will be the URL that people will see and use when accessing your content, so CNAMEs such as cdn.example.com or static.example.com are commonly used.</p>
<p>In Cloudflare, make sure the proxy status for your domain or subdomain is set to DNS only. If proxied is enabled, verification with Microsoft will fail.</p>
<p>Once you’ve added the required record to your domain name, enter the URL in the text field below in the Azure Portal. Click “Save”, and if the DNS changes have propogated (this can take up to 24-48 hours depending on your provider and configuration) then the custom domain should be added successfully. Otherwise, try again later once the changes have propegated.</p>
<p><strong>Enable the Cloudflare proxy</strong><br>
Once you’ve verified your domain, you can enable caching on Cloudflare. Go back to your domain or subdomain in the DNS tab, and click the cloud icon until it’s orange and “Proxied” shows.</p>
<p>Then go to “Caching” and set the “Caching level” to standard.</p>
<p>Finally, by default Cloudflare will only cache certain types of files. If you’re serving predominantly static HTML or CSS files, this might be OK but if you’re sending other content types such as JSON you’ll need to add a page rule so that the files are cached.</p>
<p>Go to the “Page Rules” tab, and choose “Create Page Rule”. Enter the domain/subdomain you’re using for blob storage (eg cdn.example.com) and then click “Add a setting”. Choose “Cache Level” and select “Cache Everything”. This will now cache everything served on this domain, using either the Cloudflare defaults or the cache-control headers applied to the individual files.</p>
<p><strong>Upload files to Blob Storage with cache-control headers set</strong><br>
Now, upload some files to your blob storage account in the Azure Portal. Depending on how you upload the files, you’ll need to set the cache-control headers. The .NET SDK has built-in support, or you can use <a href="https://azure.microsoft.com/en-au/resources/samples/storage-blobs-powershell-cache-control/">these instructions</a> to use PowerShell.</p>
<p><strong>Conclusion</strong><br>
By enabling Cloudflare for your domain, you’re now saving money each month on bandwidth costs (Cloudflare will only request resources once the cached copy expires) and protecting yourself from a variety of security attacks.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Using Azure Functions with Rider</title>
      <link>https://thecloudhub.com/2019/06/18/using-azure-functions-with-rider/</link>
      <pubDate>Tue, 18 Jun 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/06/18/using-azure-functions-with-rider/</guid>
      <description>Previously we&amp;rsquo;ve written about how to get started with Azure Functions using JetBrains Rider - but that&amp;rsquo;s now an outdated article, as the Azure plugin now offers seamless integration with the Microsoft Functions tooling. Gone are the days of manually updating project configuration files.
What you&amp;rsquo;ll need In order to follow along, you&amp;rsquo;ll need to make sure you:
Install JetBrains Rider (free 30-day trial available here) 2019.1 or later Getting started First you&amp;rsquo;ll want to install the Azure Toolkit for Rider.</description>
      <content:encoded><![CDATA[<p>Previously we&rsquo;ve written about how to get started with Azure Functions using JetBrains Rider - but that&rsquo;s now an outdated article, as the Azure plugin now offers seamless integration with the Microsoft Functions tooling. Gone are the days of manually updating project configuration files.</p>
<h2 id="what-youll-need">What you&rsquo;ll need</h2>
<p>In order to follow along, you&rsquo;ll need to make sure you:</p>
<ul>
<li>Install JetBrains Rider (<a href="https://www.jetbrains.com/rider/">free 30-day trial available here</a>) 2019.1 or later</li>
</ul>
<h2 id="getting-started">Getting started</h2>
<p>First you&rsquo;ll want to install the <a href="https://plugins.jetbrains.com/plugin/11220-azure-toolkit-for-rider">Azure Toolkit for Rider</a>. Open Rider then navigate to Preferences (JetBrains Rider &gt; Preferences on a Mac) and Plugins.</p>
<p>In the Plugins screen, go to the Marketplace tab  and search for &ldquo;Azure Toolkit for Rider&rdquo;. Click install.</p>
<p>This will now allow you to manage and deploy a whole bunch of Azure services from within Rider, such as App Services and SQL databases.</p>
<p>Let&rsquo;s open a new Functions app. Now that you&rsquo;ve installed the Azure Toolkit, a new template for AzureFunctions has been added to your new project window. From within Rider, click File &gt; New and choose Azure Functions from underneath the .NET Core section.</p>
<p>Enter a solution name, project name and choose a directory and language, and then click Create. If you&rsquo;re using this as a test project, you can probably leave these values as is.</p>
<h2 id="running-the-functions-app">Running the Functions app</h2>
<p>And that&rsquo;s almost all there is to using Functions apps in Rider now! The toolkit will automatically detect that it&rsquo;s a function app, and provide the necessary scaffolding to allow you to run and debug the app.</p>
<p>Gone are the days of hacking the project settings and configuration to make it work - it&rsquo;s a seamless experience now.</p>
<p>To verify that the config is correct, click the run configuration in the top right-hand side of Rider, and edit the configurations. You should see a default Azure Functions host configuration, complete with all the settings required to run a functions app. You can see in this example that the function will run on port 7071, and pause on error.</p>
<p>Even better, is that if you don&rsquo;t have the required Functions command line tools to run the app (which Rider relies on behind the scenes) then you&rsquo;ll even get prompted to install them - which Rider will do automatically on your behalf. You&rsquo;ll also get prompted if your tools are out of date.</p>
<p>And that&rsquo;s how easy it is now to get started using Azure Functions in Rider!</p>
]]></content:encoded>
    </item>
    <item>
      <title>Building Azure Functions in the Rider IDE</title>
      <link>https://thecloudhub.com/2019/03/31/building-azure-functions-in-the-rider-ide/</link>
      <pubDate>Sun, 31 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/03/31/building-azure-functions-in-the-rider-ide/</guid>
      <description>Many people now use Rider as their integrated development environment editor for .NET. However, when it comes to using it for developing Azure Functions, the out-of-the-box experience is (currently) less than ideal.
I say currently, because in the next update to the Azure Toolkit plugin for Rider Functions support has been added. This&amp;rsquo;ll make running and debugging function apps a breeze.
Until then though, here&amp;rsquo;s how you can run a functions app from Rider.</description>
      <content:encoded><![CDATA[<p>Many people now use Rider as their integrated development environment editor for .NET. However, when it comes to using it for developing Azure Functions, the out-of-the-box experience is (currently) less than ideal.</p>
<p>I say currently, because in the next update to the <a href="https://plugins.jetbrains.com/plugin/11220-azure-toolkit-for-rider">Azure Toolkit plugin</a> for Rider Functions support <a href="https://github.com/JetBrains/azure-tools-for-intellij/pull/162">has been added</a>. This&rsquo;ll make running and debugging function apps a breeze.</p>
<p>Until then though, here&rsquo;s how you can run a functions app from Rider.</p>
<h2 id="how-to-run-azure-functions-in-rider">How to run Azure functions in Rider</h2>
<p>First, you&rsquo;ll need to install the function CLI (see creating an Azure function for the Mac).</p>
<p>Then, open your functions app in Rider by selecting the project or solution.</p>
<p>Create a Properties folder in the root directory if you don&rsquo;t have one already, and then inside of that create a new JSON file called <code>launchSettings.json</code>.</p>
<p>Inside the JSON file, place the following object:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">6
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">7
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">8
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">9
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>    &#34;profiles&#34;: {
</span></span><span style="display:flex;"><span>        &#34;functions&#34;: {
</span></span><span style="display:flex;"><span>            &#34;commandName&#34;: &#34;Executable&#34;,
</span></span><span style="display:flex;"><span>            &#34;executablePath&#34;: &#34;func&#34;,
</span></span><span style="display:flex;"><span>            &#34;commandLineArgs&#34;: &#34;start --port 7071 --pause-on-error&#34;
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></td></tr></table>
</div>
</div><p>You should see Rider now refresh, and add the configuration profile to your configurations with a little rocket icon. Click run, and your function app should start running within Rider.</p>
<p>Note that debugging is a little tricker for now. On Windows, once your function app is running you can go &ldquo;Run&rdquo; &gt; &ldquo;Attach to process&rdquo; and choose your function app to listen to. But on a Mac, this has had mixed results.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Azure App Configuration vs App Settings</title>
      <link>https://thecloudhub.com/2019/03/28/azure-app-configuration-vs-app-settings/</link>
      <pubDate>Thu, 28 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/03/28/azure-app-configuration-vs-app-settings/</guid>
      <description>For a long time now, App Settings have been the way to configure your app&amp;rsquo;s settings such as environment variables and connection strings for Azure App Services.
In February 2019, Microsoft announced a new service called App Configuration - which, currently in preview - allows you to easily centralise your app settings across multiple resources.
Why is App Settings a problem? App Settings are great - if you only need those settings for one resource (eg.</description>
      <content:encoded><![CDATA[<p>For a long time now, App Settings have been the way to configure your app&rsquo;s settings such as environment variables and connection strings for Azure App Services.</p>
<p>In February 2019, Microsoft announced a new service called App Configuration - which, currently in preview - allows you to easily centralise your app settings across multiple resources.</p>
<h2 id="why-is-app-settings-a-problem">Why is App Settings a problem?</h2>
<p>App Settings are great - if you only need those settings for one resource (eg. an app service). But if you&rsquo;re working with, say, a microservice that might be made up of many resources including an app service and maybe a functions app that all share similar configurations, keeping track of what settings were made where can quickly become problematic.</p>
<p>Amongst other things, there&rsquo;s no easy way to do things like point-in-time replays of settings, so you can see what changed or keep the settings the same if you need to rebuild or deploy a specific version of your app.</p>
<h2 id="what-does-app-configuration-offer-that-app-settings-doesnt">What does App Configuration offer that App Settings doesn&rsquo;t?</h2>
<p>App Configuration is a fully managed service that offers the ability to store all your app configuration values in one location, with the ability to compare settings at specific times and with specific labels.</p>
<p>Operating in a similar fashion to Key Vault, it&rsquo;s a separate resource from your app service (although you can configure it immediately by going to the new preview tab in your app services), and there are a number of SDKs available to integrate with it for .NET core,  .NET and Java.</p>
<p>You can think of App Configuration as a counterpart to Key Vault for properties that don&rsquo;t need to be stored as secrets. Connection strings would likely still go in Key Vault, but properties that aren&rsquo;t secrets should be stored in App Configuration.</p>
<p>First you&rsquo;ll need to setup a connection string which you can find under the &ldquo;Settings&rdquo; → &ldquo;Access Keys&rdquo; section of your App Configuration resource. Then, within App Configuration, you set a number of key value pairs, which you can then access in a similar fashion to the way you get environment variables in App Settings:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-csharp" data-lang="csharp"><span style="display:flex;"><span><span style="color:#66d9ef">var</span> configBuilder = <span style="color:#66d9ef">new</span> ConfigurationBuilder();
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">var</span> config = Environment.GetEnvironmentVariable(<span style="color:#e6db74">&#34;YourKeyNameFromAppConfiguration&#34;</span>)
</span></span><span style="display:flex;"><span>configBuilder.AddAzureAppConfiguration(config);
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">var</span> config = configBuilder.Build();
</span></span></code></pre></td></tr></table>
</div>
</div><p>You can also import and export settings easily, and can use JSON, YAML or a Properties file. You can also export the settings for a specific time and date.</p>
<p>At present, because the service is in preview there are no additional charges. Microsoft hasn&rsquo;t yet stated its intentions for charging for this service, but given the similarities with Key Vault (which is a paid service) it&rsquo;s easy to see how a similar model <em>could</em> apply if they decided.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Which Azure Functions runtime am I using?</title>
      <link>https://thecloudhub.com/2019/03/25/which-azure-functions-runtime-am-i-using/</link>
      <pubDate>Mon, 25 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/03/25/which-azure-functions-runtime-am-i-using/</guid>
      <description>Microsoft currently support two versions of the Azure Functions runtime - version 1 and version 2. This post will look at the main changes between the two versions, and show you how you can check which runtime you&amp;rsquo;re using.
What are the key differences between versions? Version 1 of the runtime was introduced back in 2016, when functions were first announced. At launch it supported JavaScript, C#, Python and PHP.</description>
      <content:encoded><![CDATA[<p>Microsoft currently support two versions of the Azure Functions runtime - version 1 and version 2. This post will look at the main changes between the two versions, and show you how you can check which runtime you&rsquo;re using.</p>
<h2 id="what-are-the-key-differences-between-versions">What are the key differences between versions?</h2>
<p>Version 1 of the runtime was introduced back in 2016, when functions were first announced. At launch it supported JavaScript, C#, Python and PHP.</p>
<p>In late September 2018 Microsoft made <a href="https://azure.microsoft.com/en-au/blog/introducing-azure-functions-2-0/">the Functions 2 runtime generally available</a> and with it bought a number of significant development, deployment and performance improvements including the ability to use the runtime anywhere - on a Mac or Linux machine too! It&rsquo;s worth noting that as of March 2019, Python support for Functions 2 is still in preview.</p>
<p>There were significant under the hood changes made to improve performance - and .NET Core 2.1 support was added, alongside a move to .NET Core powering the functions host process instead of .NET.</p>
<p>Big changes were made to the way that bindings work - as part of 2.0 they became extensions instead of being bundled into the runtime itself (aside from HTTP and timer support which are deemed core to the experience). This means that some bindings didn&rsquo;t make it over yet to the new 2.0 runtime - your mileage may vary, but the <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings#supported-bindings">Microsoft bindings docs</a> have a clearer comparison between the two.</p>
<p>There are also a bunch of new integrations with Functions 2 - for instance, Application Insights is supported with minimal configuration required, while you can easily use deployment centre to add code from other sources such as Github repos into your functions app.</p>
<h2 id="how-can-i-tell-what-runtime-im-using">How can I tell what runtime I&rsquo;m using?</h2>
<p>If you&rsquo;re running a functions app on a Mac or Linux machine - there&rsquo;s a fair chance you&rsquo;re using the 2.0 runtime, as that&rsquo;s what the functions command line tools support. You can verify this by opening the <code>host.json file</code> within the root directory of your app, which should look something like this:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>{    &#34;version&#34;: &#34;2.0&#34;,    &#34;extensions&#34;: {      &#34;http&#34;: {        &#34;routePrefix&#34;: &#34;&#34;      }    } }
</span></span></code></pre></td></tr></table>
</div>
</div><p>The <code>version</code> field directly references the version of the functions runtime you&rsquo;re using. If it says 2.0, you&rsquo;re using version 2 - if it&rsquo;s 1 or missing completely, you&rsquo;re on the first version of the runtime.</p>
<p>Similarly, you can also view the runtime for your app through the Azure Portal - open your app in the portal, then navigate to &ldquo;Function app settings&rdquo; where you&rsquo;ll see the below &ldquo;Runtime version&rdquo; setting.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Azure Functions App vs Functions</title>
      <link>https://thecloudhub.com/2019/03/24/azure-functions-app-vs-function/</link>
      <pubDate>Sun, 24 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/03/24/azure-functions-app-vs-function/</guid>
      <description>A common question asked by newcomers to the world of Azure Functions, is what&amp;rsquo;s the difference between an Azure functions app vs a function? Are they the same thing?
In short, there is a difference. You can think of the f_unctions app_ as if it refers to a workspace that contains one or more functions. It&amp;rsquo;s essentially a wrapper (or in .NET terms, project), holding all your Azure functions in one place and allowing for easy deployment and management of them as one.</description>
      <content:encoded><![CDATA[<p>A common question asked by newcomers to the world of Azure Functions, is what&rsquo;s the difference between an Azure functions app vs a function? Are they the same thing?</p>
<p>In short, there is a difference. You can think of the f_unctions app_ as if it refers to a workspace that contains one or more functions. It&rsquo;s essentially a wrapper (or in .NET terms, project), holding all your Azure functions in one place and allowing for easy deployment and management of them as one.</p>
<p>On the other hand, a function refers to a single, isolated piece of functionality. Typically in .NET this results in a class that performs one discrete piece of behaviour.</p>
<p>There are a number of ramifications for function apps that don&rsquo;t apply to individual functions. For instance, it&rsquo;s at the function app level that the pricing plan, runtime version and more are set in Azure. Microsoft refers to this as providing the <em>execution context</em> for your functions.</p>
<p>So keep in mind that when you first create a function resource in the Azure Portal, you&rsquo;re creating a functions app. Once you navigate inside that resource, you can then start to add individual functions.</p>
]]></content:encoded>
    </item>
    <item>
      <title>What&#39;s an Azure Service Principal and Managed Identity?</title>
      <link>https://thecloudhub.com/2019/03/22/whats-an-azure-service-principal-and-managed-identity/</link>
      <pubDate>Fri, 22 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/03/22/whats-an-azure-service-principal-and-managed-identity/</guid>
      <description>In this post, we&amp;rsquo;ll take a brief look at the difference between an Azure service principal and a managed identity (formerly referred to as a Managed Service Identity or MSI).
Dive deeper into Azure AD service principals and managed identities in our new detailed ebook about Azure AD
What is a service principal or managed service identity? Lets get the basics out of the way first. In short, a service principal can be defined as:</description>
      <content:encoded><![CDATA[<p>In this post, we&rsquo;ll take a brief look at the difference between an Azure service principal and a managed identity (formerly referred to as a Managed Service Identity or MSI).</p>
<p><a href="https://thecloudhub.com/books/azure-ad-apps/">Dive deeper into Azure AD service principals and managed identities in our new detailed ebook about Azure AD</a></p>
<h2 id="what-is-a-service-principal-or-managed-service-identity">What is a service principal or managed service identity?</h2>
<p>Lets get the basics out of the way first. In short, a service principal can be defined as:</p>
<blockquote>
<p>An application whose tokens can be used to authenticate and grant access to specific Azure resources from a user-app, service or automation tool, when an organisation is using Azure Active Directory.</p>
</blockquote>
<p>In essence, service principals help us avoid having to create fake users in Active Directory in order to manage authentication when we need to access Azure resources.</p>
<p>Stepping back a bit, and its important to remember that service principals are defined on a per-tenant basis. This is different to the application in which principals are created - the application sits across every tenant.</p>
<p>Managed identities are often spoken about when talking about service principals, and that&rsquo;s because its now the preferred approach to managing identities for apps and automation access. In effect, a managed identity is a layer on top of a service principal, removing the need for you to manually create and manage service principals directly.</p>
<p>There are two types of managed identities:</p>
<ul>
<li>
<p>System-assigned: These identities are tied directly to a resource, and abide by that resources&rsquo; lifecycle. For instance, if that resource is deleted then the identity too will be removed</p>
</li>
<li>
<p>User-assigned: These identities are created independent of a resource, and as such can be used between different resources. Removing them is a manual process whenever you see fit</p>
</li>
</ul>
<p>One of the problems with managed identities is that for now only a <a href="https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-msi">limited subset of Azure services support using them</a> as an authentication mechanism. If the service you use doesn&rsquo;t support MI, then you&rsquo;ll need to either continue to manually create your service/security principals.</p>
<h2 id="so-whats-the-difference">So what&rsquo;s the difference?</h2>
<p>Put simply, the difference between a managed identity and a service principal is that a managed identity <em>manages</em> the creation and automatic renewal of a service principal on your behalf.</p>
<p><strong>Update 31/1/20:</strong> If you&rsquo;re using Azure Web Apps, check out our <a href="https://thecloudhub.com/2020/01/managed-identities-and-azure-app-service-staging-slots/">new post on using managed identities with deployment slots</a></p>
]]></content:encoded>
    </item>
    <item>
      <title>How to add Application Insights to an Azure function</title>
      <link>https://thecloudhub.com/2019/03/18/how-to-add-application-insights-to-an-azure-function/</link>
      <pubDate>Mon, 18 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/03/18/how-to-add-application-insights-to-an-azure-function/</guid>
      <description>Today we&amp;rsquo;re going to look at how easy it is to add Azure Application Insights (part of Azure Monitor) to an Azure Function.
What is Application Insights? In short, Application Insights is a performance and monitoring tool that forms part of the Azure Monitor suite. It allows you to access detailed telemetry on requests made to your function, while observing real-time performance and failures. It works across App Service apps, Azure Functions and more - practically anywhere you can install the available App Insights SDKs.</description>
      <content:encoded><![CDATA[<p>Today we&rsquo;re going to look at how easy it is to add Azure Application Insights (part of Azure Monitor) to an Azure Function.</p>
<h2 id="what-is-application-insights">What is Application Insights?</h2>
<p>In short, Application Insights is a performance and monitoring tool that forms part of the Azure Monitor suite. It allows you to access detailed telemetry on requests made to your function, while observing real-time performance and failures. It works across App Service apps, Azure Functions and more - practically anywhere you can install the available <a href="https://github.com/Microsoft/ApplicationInsights-Home">App Insights SDKs</a>.</p>
<p>You can find the full pricing information <a href="https://azure.microsoft.com/en-us/pricing/details/monitor/">here</a>, but you effectively get charged per GB of ingested data (5GB included free per month).</p>
<h2 id="how-can-i-enable-this-for-my-azure-function-app">How can I enable this for my Azure Function App?</h2>
<p>For Azure Functions, it&rsquo;s super simple to enable App Insights. You don&rsquo;t even need to add the SDKs - Microsoft handles that for you.</p>
<p>First, you&rsquo;ll need to create an Application Insights instance. Open the Azure Portal, click &ldquo;Create a resource&rdquo; and search for &ldquo;Application Insights&rdquo;.</p>
<p>Enter a friendly and unique name for your instance, and depending on the language you write your functions in, choose General or Node.js for the &ldquo;Application Type&rdquo;.</p>
<p>Choose a subscription and resource group (ideally matching those of your Azure Function app) and a location. Note that App Insights is only supported in a limited number of regions worldwide, so you might need to choose a different region to that of your functions app.</p>
<p>Once that&rsquo;s been created, open the App Insights resource. On the &ldquo;Overview&rdquo; page, you&rsquo;ll see in the top section an &ldquo;Instrumentation Key&rdquo;. Copy this - it&rsquo;s essentially the identifier that will allow you function app to report data back into this App Insights resource.</p>
<p>Now navigate to your function app in the Azure Portal. Select the app name in the sidebar, and choose &ldquo;Platform Features&rdquo; on the right-hand side of the screen.</p>
<p>Next, open &ldquo;Application settings&rdquo;. Scroll down until you see the &ldquo;Application settings&rdquo; header. At the bottom of this section, you&rsquo;ll see a &ldquo;Add new setting&rdquo; button - click this to add a new row.</p>
<p>Now in the &ldquo;App Setting Name&rdquo; column, type &ldquo;APPINSIGHTS_INSTRUMENTATIONKEY&rdquo;. In the &ldquo;Value&rdquo; column, paste the &ldquo;Instrumentation Key&rdquo; that we copied in the earlier step from your App Insights resource. Scroll back to the top of the page, and click &ldquo;Save&rdquo;.</p>
<h2 id="summary">Summary</h2>
<p>And that&rsquo;s it! That&rsquo;s how easy it is to enable App Insights for Azure Functions. If you want to see metrics coming through straight away, navigate to your App Insights resource and click &ldquo;Live Metrics&rdquo;. Make an API request to your function (assuming it&rsquo;s HTTP based - otherwise trigger it however you can) and you should see the request come through instantly.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Create an Azure Function App using a Mac</title>
      <link>https://thecloudhub.com/2019/03/14/create-an-azure-function-app-using-a-mac/</link>
      <pubDate>Thu, 14 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/03/14/create-an-azure-function-app-using-a-mac/</guid>
      <description>In this post, we&amp;rsquo;ll take a look at how you can quickly create an Azure Function when using a Mac. In particular, we&amp;rsquo;ll be using the Azure Functions command line tools to create our functions app.
Getting started Before you can create a function, you&amp;rsquo;ll need to install the Azure Function command line tools. But before you can continue, you need to make sure that you have installed Brew. If you&amp;rsquo;re not familiar with it, Brew is a package manager for the Mac - similar to NPM for Node.</description>
      <content:encoded><![CDATA[<p>In this post, we&rsquo;ll take a look at how you can quickly create an Azure Function when using a Mac. In particular, we&rsquo;ll be using the Azure Functions command line tools to create our functions app.</p>
<h2 id="getting-started">Getting started</h2>
<p>Before you can create a function, you&rsquo;ll need to install the Azure Function command line tools. But before you can continue, you need to make sure that you have <a href="https://brew.sh/">installed Brew</a>. If you&rsquo;re not familiar with it, Brew is a package manager for the Mac - similar to NPM for Node.Js projects.</p>
<p>Once you&rsquo;ve installed Brew, make sure you have the latest .NET Core SDK installed. If you&rsquo;re not sure, open Terminal and run:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>dotnet --version
</span></span></code></pre></td></tr></table>
</div>
</div><p>If you do get a version back, make sure it&rsquo;s at least 2.0.0 or above. If you get an error, you&rsquo;ll need to install it using the following Brew commands:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>brew tap caskroom/caskbrew cask install dotnet
</span></span></code></pre></td></tr></table>
</div>
</div><p>Run the same <code>dotnet version</code> command again to ensure the install was successful.</p>
<p>Now we need to install the Azure Function Core Tools:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>brew tap azure/functionsbrew install azure-functions-core-tools
</span></span></code></pre></td></tr></table>
</div>
</div><p>Once the install has finished, you&rsquo;re now ready to go creating your first function!</p>
<h2 id="creating-the-function-app">Creating the function app</h2>
<p>Now that we&rsquo;ve got all the dependencies installed, it&rsquo;s time to create our function app. Open Terminal, and navigate to a directory where you&rsquo;d like your app to be created (in our case, we&rsquo;re going to create it from the root Documents folder).</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>cd ~/Documents
</span></span></code></pre></td></tr></table>
</div>
</div><p>Now let&rsquo;s get started creating the app! First lets initialise the project:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>func init MyFirstFunctionApp --source-control true --worker-runtime dotnet
</span></span></code></pre></td></tr></table>
</div>
</div><p>This will create a folder called <code>MyFirstFunctionApp</code> inside your <code>Documents</code> folder. It will be initialised as a git repository (the source-control parameter) and have a dotnet runtime. If you&rsquo;d prefer a Node.Js function or a Python function, you can replace dotnet with either <code>node</code> or <code>python</code> respectively.</p>
<p>You&rsquo;ll now have your project - but at this point, it&rsquo;ll be empty with no functions. To add your first function, we need to run the following command to generate a function called MyFirstFunction:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span> func new --name MyFirstFunction
</span></span></code></pre></td></tr></table>
</div>
</div><p>It&rsquo;ll then ask you what type of template you&rsquo;d like to use. A template is effectively a trigger - what will cause your function to start running? We&rsquo;ll choose #2 (HttpTrigger) for now, as this will enable you to easily run your function via Curl, Postman or by visiting a page in your web browser. You can provide this in the previous command as <code>—template</code>, or select from the list.</p>
<p>You&rsquo;ll now have your first function and function app created! You can run it by entering:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>func start
</span></span></code></pre></td></tr></table>
</div>
</div><p>Once it&rsquo;s started, you should see the a message with the function URL, like this:</p>
<p>The sample function expects a name parameter to be provided, so open up your web browser and go to <a href="http://localhost:7071/api/MyFirstFunction?name=Bob">http://localhost:7071/api/MyFirstFunction?name=Bob</a>. You should get a response like:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fallback" data-lang="fallback"><span style="display:flex;"><span>Hello, Bob
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="summary">Summary</h2>
<p>So that&rsquo;s how easy it is to get started with an Azure Function app on a Mac. Microsoft has done a lot of work around the tooling to make it as straightforward as possible.</p>
]]></content:encoded>
    </item>
    <item>
      <title>What&#39;s the difference between an Azure Service Bus queue and topic?</title>
      <link>https://thecloudhub.com/2019/03/13/whats-the-difference-between-an-azure-service-bus-queue-and-topic/</link>
      <pubDate>Wed, 13 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://thecloudhub.com/2019/03/13/whats-the-difference-between-an-azure-service-bus-queue-and-topic/</guid>
      <description>Starting out with an Azure Service Bus? It can be confusing trying to work out whether you should use a queue or a topic. In this post, we&amp;rsquo;ll try to break down the difference between the two and which one you should use when.
What is a service bus queue or topic? When configuring a service bus, you have two options for configuring how messages are processed - a queue, or a topic.</description>
      <content:encoded><![CDATA[<p>Starting out with an Azure Service Bus? It can be confusing trying to work out whether you should use a queue or a topic. In this post, we&rsquo;ll try to break down the difference between the two and which one you should use when.</p>
<h2 id="what-is-a-service-bus-queue-or-topic">What is a service bus queue or topic?</h2>
<p>When configuring a service bus, you have two options for configuring how messages are processed - a queue, or a topic.</p>
<p>Lets start with a queue. A queue has a one-to-one relationship between each message and its consumer, and is a way to ensure reliable first-in-first-out (FIFO) delivery to <em>one</em> processor from many sources. For example, you might have one WebJob that processes requests that get placed in the queue from many different sources. In most cases, the processor (or receiver) receives the messages in the same order that they were placed on the queue. The key to a queue is that each message from the queue is only ever processed by a single consumer.</p>
<p>In contrast, a topic follows the publish/subscribe pattern and can have many consumers who can each subscribe to receive notifications when a message is sent to the topic. In effect, this means you can have a one-to-many relationship between messages and consumers although this does depend on how you configure your filter rules (you can opt to have each message delivered to only 1 subscriber if you wish).</p>
<h2 id="whats-the-difference">What&rsquo;s the difference?</h2>
<p>In effect, the difference between a queue and topic can be described as follows:</p>
<ul>
<li>A queue can only be listened to by one consumer, whereas a topic can have multiple subscribers.</li>
<li>Topic subscriptions can <a href="https://github.com/Azure/azure-service-bus/tree/master/samples/DotNet/GettingStarted/Microsoft.Azure.ServiceBus/TopicSubscriptionWithRuleOperationsSample">enable powerful filtering capabilities</a>, such that you can define certain parameters that messages must meet in order to be copied into a subscriptions virtual queue. This can be handy if you need to handle different types of messages, or messages with variable data structures in the same topic.</li>
<li>Topics can be more scalable than queues, as more than one consumer can listen for messages. If you need to scale a queue, you&rsquo;re still limited to having the one consumer listening, so aside from horizontal scaling you&rsquo;re out of luck.</li>
<li>Both queue and topic subscriptions support <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.servicebus.receivemode">PeekLock</a> and <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.servicebus.receivemode">ReceiveAndDelete</a> modes, so you can ensure a message is processed before being dismissed if required.</li>
</ul>
<h2 id="when-should-i-use-a-topic-or-queue">When should I use a topic or queue?</h2>
<p>This is a trickier question to answer, and ultimately depends on how much you&rsquo;re <a href="https://azure.microsoft.com/en-us/pricing/details/service-bus/">willing to spend</a> on your service bus. If you&rsquo;re using the basic tier, then you only have the one option - queues. Topics are only supported in the standard and premium tier.</p>
<p>By moving to the standard or premium tier, you incur an hourly base charge as well as the per million operations fee which is charged in the basic tier.</p>
<p>Pricing aside, it also depends on the type of data that you&rsquo;re ingesting into your service bus. If its time-sensitive and high volume, topics would be the ideal approach as you can more easily scale your downstream consumer to handle the larger volume of messages.</p>
<p>If on the other hand you receive a relatively stable or low volume of messages which aren&rsquo;t necessarily time-critical (ie. they may sit on a queue for some time until the processor reaches them if the load is higher than anticipated) then you can probably get away with using a queue.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
