<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Dan Wright</title>
    <description>The latest articles on Forem by Dan Wright (@danwright).</description>
    <link>https://forem.com/danwright</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F10941%2F43616ccc-0210-4645-bf86-743bfcd2ba17.jpg</url>
      <title>Forem: Dan Wright</title>
      <link>https://forem.com/danwright</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/danwright"/>
    <language>en</language>
    <item>
      <title>Deploying static webs apps with the Azure cli and bicep</title>
      <dc:creator>Dan Wright</dc:creator>
      <pubDate>Tue, 04 Jun 2024 22:49:08 +0000</pubDate>
      <link>https://forem.com/danwright/deploying-static-webs-apps-1dib</link>
      <guid>https://forem.com/danwright/deploying-static-webs-apps-1dib</guid>
      <description>&lt;h2&gt;
  
  
  Deploying static web apps
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A brief intro deploying Azure static web apps using the Azure cli, and Bicep, Microsoft’s domain specific language (DSL) for deploying Azure resources.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This will deploy a create-react-app (CRA) starter repo located in a DevOps repo using a simple .yaml file into a static app resource.&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure cli deployment
&lt;/h2&gt;

&lt;p&gt;As a precursor to deploying via the cmd line you will need the azure cli installed &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use &lt;code&gt;az version&lt;/code&gt; to determine if you have the cli installed. If not follow these instructions for installing &lt;a href="https://learn.microsoft.com/en-us/cli/azure/install-azure-cli" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/cli/azure/install-azure-cli&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Login using &lt;code&gt;az login&lt;/code&gt; and set the subscription you wish to work in with &lt;code&gt;az account set --subscription &amp;lt;SUBSCRIPTION-NAME&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Create a resource group to manage any resource deployed using &lt;code&gt;az group create –name &amp;lt;RESOURCE-NAME&amp;gt;  –location &amp;lt;LOCATION&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally deploy the resource into the resource group at a location &lt;code&gt;az staticwebapp create – name &amp;lt;SWA-RESOURCE-NAME&amp;gt; –resource-group &amp;lt;RESOURCE-NAME&amp;gt; –location &amp;lt;LOCATION&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the Azure portal under resource groups navigate to the newly deployed resource group which will contain the static web app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bicep
&lt;/h2&gt;

&lt;p&gt;This will deploy 1 resource and 1 module into a resource group within a subscription. Create a new git repo in Azure Devops to work in which will can be deployed using a &lt;code&gt;./azure-pipelines.yaml&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;In order to create the resource group set the scope of the &lt;code&gt;./main.bicep&lt;/code&gt; file from its default of resourceGroup to subscription and then deploy the resource. The parameters needed will be passed in from a &lt;code&gt;./mian.parameters.bicepparam&lt;/code&gt; file that can be altered.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;./main.bicep&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;targetScope = 'subscription'

// Parameters imported from `./mian.parameters.bicepparam` file
param globalTags object
param resourceGroupName string
param resourceGroupLocation string
@description('Timestamp last deployment')
param utcShort string = utcNow('d')

var customTags = {
  LastDeployed: utcShort
}

resource resourceGroup 'Microsoft.Resources/resourceGroups@2024-03-01' = {
  name: resourceGroupName
  location: resourceGroupLocation
  tags: union(globalTags, customTags)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parameters file will hold customizable options needed to deploy the resources. Update the resource group name and location with values and add custom global tags to be used in all resources.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;./main.parameters.bicepparam&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using './main.bicep'

param globalTags = {
  Environment: 'Dev'
}

param resourceGroupLocation = '&amp;lt;RESOURCE-GROUP-LOCATION&amp;gt;'
param resourceGroupName = '&amp;lt;RESOURCE-GROUP-NAME&amp;gt;'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To add the staticWebApp and keep its config out of the main file and aid reuse add the staticWebApp as a module.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;./modules/static-web-app.bicep&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@description('Global tags')
param tags object
@allowed(['centralus', 'eastus', 'eastus2', 'westus', 'westus2'])
param resourceGroupLocation string
@description('Timestamp last deployment')
param utcShort string = utcNow('d')

var customTags = {
  LastDeployed: utcShort
}

resource staticwebapp 'Microsoft.Web/staticSites@2023-12-01' = {
  name: 'azStaticWebApp'
  location: resourceGroupLocation
  tags: union(tags, customTags)
  properties: {}
  sku: {
    name: 'Free'
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From here you can deploy the resources using the Azure cli, using &lt;code&gt;az deployment sub create --location centralus --template-file ./main.bicep --parameters './main.parameters.bicepparam'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To deploy the resources through a pipeline create a &lt;code&gt;'./azure-pipelines.yaml'&lt;/code&gt; file and use an inlineScript to run the same cli command as above.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;'./azure-parameters.yaml'&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;trigger:
- main

name: Bicep deploy

variables:
  vmImageName: 'ubuntu-latest'
  AzureServiceConnection: &amp;lt;SERVICE-CONNECTION-NAME&amp;gt;
  bicepParamFile: './main.parameters.bicepparam'

pool:
  vmImage: $(vmImageName)

steps:
- task: AzureCLI@2
  inputs:
    azureSubscription: $(AzureServiceConnection)
    scriptType: bash
    scriptLocation: inlineScript
    useGlobalConfig: false
    inlineScript: az deployment sub create --location &amp;lt;LOCATION&amp;gt; --template-file ./main.bicep --parameters $(bicepParamFile)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Azure DevOps create a service connection that can be used to grant access to Azure for deploying resources into:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;DevOps -&amp;gt; project settings -&amp;gt; service connections&lt;/li&gt;
&lt;li&gt;New service conection -&amp;gt; Azure Resource Manager -&amp;gt; workload identity federeation (automatic)&lt;/li&gt;
&lt;li&gt;Scope: subscription -&amp;gt; ResourceGroup: leave blank -&amp;gt; Add a service connection name and description -&amp;gt; Grant access permission to all pipelines&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once created replace &lt;code&gt;&amp;lt;SERVICE-CONNECTION-NAME&amp;gt;&lt;/code&gt; with the name of the newly created service connection and push the code changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy create react app
&lt;/h2&gt;

&lt;p&gt;Create a new repo with create react app and add a &lt;code&gt;'./azure-pipelines.yaml'&lt;/code&gt; file that deploys the repo in the static web app any time new changes are pushed to it. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;'./azure-parameters.yaml'&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;trigger:
  - main

pool:
  vmImage: ubuntu-latest

steps:
  - checkout: self
    submodules: true
  - task: AzureStaticWebApp@0
    inputs:
      app_location: '/'
      output_location: '/build'
    env:
      azure_static_web_apps_api_token: $(deployment_token)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Get the deployment token from the static app resource under the &lt;code&gt;Manage deployment token&lt;/code&gt; at the top of the overview tab.&lt;/p&gt;

&lt;p&gt;Inside Azure DevOps click create a new pipeline from an Azure GitRepo with an existing Azure pipelines yaml file. On the review stage add new variable for the deployment_token and add the static web app deployment token before running.&lt;/p&gt;

&lt;p&gt;Validate the web app has been deployed by navigating to the URL on the overview tab.&lt;/p&gt;

&lt;p&gt;Now any time now changes are pushed to the create-react-repo those changes will be deployed to the web app.&lt;/p&gt;

&lt;p&gt;Link to the &lt;a href="https://github.com/sirBassetDeHound/techTuesday" rel="noopener noreferrer"&gt;Git repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>azure</category>
      <category>devops</category>
      <category>bicep</category>
      <category>react</category>
    </item>
    <item>
      <title>Developing Azure functions using reusable Bicep modules</title>
      <dc:creator>Dan Wright</dc:creator>
      <pubDate>Mon, 24 Apr 2023 13:32:22 +0000</pubDate>
      <link>https://forem.com/danwright/developing-azure-functions-using-reusable-bicep-modules-3nb6</link>
      <guid>https://forem.com/danwright/developing-azure-functions-using-reusable-bicep-modules-3nb6</guid>
      <description>&lt;h2&gt;
  
  
  The benefits of infrastructure as code
&lt;/h2&gt;

&lt;p&gt;Infrastructure as code (IaC) is the practice of a creating a model in code to generate an identical environment each time it is run, reducing human error, enforcing business best practice, and allowing teams that use it to innovate and deploy needed infrastructure faster and safer than manually generating the resources when needed. IaC is a fundamental concept utilizing DevOps methodologies to automate the validation, build and deployment of infrastructure in a way that closes the gap between development teams and IT operations teams. &lt;br&gt;
Using IaC we can ensure that environments created are appreciative of cost, using environment config, reusable, using modules, and require minimal human input, using CI/CD or cmd line deployment. With this approach we can be confident that teams wishing to use our templates can do so in a business approved way giving them confidence to take innovation into the cloud or rapidly deploy new infrastructure to an existing environment.&lt;/p&gt;
&lt;h2&gt;
  
  
  Azure Resource Manager (ARM) templates
&lt;/h2&gt;

&lt;p&gt;ARM templates are JSON files that define the deployment resources and variables. They can be used to create azure resources in a declarative modular way that provides built in validation and the ability to preview changes. The template contains a schema to determine the version and language, properties, variables, function, resources, and outputs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "$schema": "https://schema.management.azure.com/schemas/...
  "contentVersion": "",
  "apiProfile": "",
  "parameters": {  },
  "variables": {  },
  "functions": [  ],
  "resources": [  ],
  "outputs": {  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When using the Azure portal to create a resource these templates can be found at the ‘Review + Create’ stage under the ‘Download a template for automation’ link at the bottom.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bicep
&lt;/h2&gt;

&lt;p&gt;Bicep is Microsoft’s domain-specific language (DSL) used to deploy Azure resources in a declarative modular way. Additionally, like ARM templates they can be used with what-if operations to preview the impact the deployment will have. Unlike ARM templates Bicep syntax is less verbose and defines simpler syntax for writing parameters and conditional operators among others and introduces annotations including @describe and @secure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure CLI (Command Line Interface)
&lt;/h2&gt;

&lt;p&gt;The Azure CLI is the simplest way to work with ARM or Bicep files and most notably can be used to:&lt;br&gt;
Decompile a Bicep file or files from an ARM templates - &lt;br&gt;
&lt;code&gt;az bicep decompile –file {ARM_TEMPLATE_NAME.json}&lt;/code&gt;&lt;br&gt;
Build an ARM template from a Bicep file - &lt;br&gt;
&lt;code&gt;az bicep build –file {BICEP_FILE_NAME.bicep}&lt;/code&gt;&lt;br&gt;
Deploy bicep to a resource group - &lt;br&gt;
&lt;code&gt;az deployment group create –name {RESOURCE_GROUP_NAME} –file {BICEP_FILE_NAME.bicep}&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Azure Functions
&lt;/h2&gt;

&lt;p&gt;Azure functions provide a platform for developers to build and deploy application logic in a way that does not require them to maintain the underlying infrastructure required to run them. Azure functions build on the principles of serverless computing by providing on-demand compute allowing consumers to meet changing demand whilst paying only for what they use.&lt;/p&gt;

&lt;p&gt;Azure Functions is a Function as a service (FaaS) and to be deployed will require:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;storage account&lt;/strong&gt; - Used to store app data, potentially app code, and will be used to manage operations including triggers and logging function executions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;hosting plan&lt;/strong&gt; - Used to define resources available and how the function is scaled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;function definition&lt;/strong&gt; - Used to define the function runtime amongst other app config&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Creating a functions resource file
&lt;/h2&gt;

&lt;p&gt;In order to run the bicep file a resource group needs to be created. To do this via the cmd line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az group create --name rgfunappdev001 --location eastus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resource group name should follow best practice naming:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rg-&amp;lt;app or service name&amp;gt;-&amp;lt;subscription purpose&amp;gt;-&amp;lt;###&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating a storage account:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@description('Storage account')
resource azStorageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
  name:  'azapp${uniqueString(resourceGroup().id)}'
  location: resourceGroup().location
  kind: 'StorageV2'
  sku: {
    name: 'Standard_LRS'
  }
  properties: {
    supportsHttpsTrafficOnly: true
    minimumTlsVersion: 'TLS1_2'
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating a hosting plan:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@description('App service plan')
resource azHostingPlan 'Microsoft.Web/serverfarms@2022-03-01' = {
  name: 'host${uniqueString(resourceGroup().id)}'
  location: resourceGroup().location
  sku: {
    name: 'Y1'
    tier: 'Dynamic'
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating a function:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@description('Function app')
resource azFunctionApp 'Microsoft.Web/sites@2022-03-01' = {
  name: 'azfun${uniqueString(resourceGroup().id)}'
  location: resourceGroup().location
  kind: 'functionapp'
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    httpsOnly: true
    publicNetworkAccess: 'Enabled'
    serverFarmId: azHostingPlan.id
    siteConfig: {
      appSettings: [
        {
          name: 'AzureWebJobsStorage'
          value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccountName};EndpointSuffix=${environment().suffixes.storage};AccountKey=${azStorageAccount.listKeys().keys[0].value}'
        }
        {
          name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
          value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccountName};EndpointSuffix=${environment().suffixes.storage};AccountKey=${azStorageAccount.listKeys().keys[0].value}'
        }
        {
          name: 'WEBSITE_CONTENTSHARE'
          value: toLower(functionAppName)
        }
        {
          name: 'FUNCTIONS_EXTENSION_VERSION'
          value: '~4'
        }
        {
          name: 'FUNCTIONS_WORKER_RUNTIME'
          value: 'node'
        }
        {
          name: 'WEBSITE_NODE_DEFAULT_VERSION'
          value: '~18'
        }
      ]
      cors: {
        allowedOrigins: ['*']
      }
      ftpsState: 'FtpsOnly'
      minTlsVersion: '1.2'
      netFrameworkVersion: 'v6.0'
      use32BitWorkerProcess: true
    }
    clientAffinityEnabled: false
    virtualNetworkSubnetId: null
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using bicep files with config hard-coded into the resources means that the file will only ever deploy that instance of the resource. Having the resource only able to do 1 specific task reduces its reusability, and, increases the need for alterations based on differing need, introducing the potential for error and not adhering to company best practice and cost. If the user wishes to deploy more than this single file, they will need to make multiple deployments, causing them to ensure they correctly deploy resources dependent on others to reduce the risk of deployment failures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Externalizing config
&lt;/h2&gt;

&lt;p&gt;The aim of decoupling the config from the resource allows the resource to be reused for differing deployment variations based on user requirements. Doing so means that config and infrastructure policy can be maintained and controlled independently of the resource creator.&lt;/p&gt;

&lt;p&gt;External JSON files can be loaded into the ./main.bicep file and then passed into the resource.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@description('Function App config')
var environmentConfigurationMap = loadJsonContent('./environmentConfigurationMap.json')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;environmentConfigMap.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "production": {},
    "test": {},
    "dev": {
        "azFunctionApp": {
            "identity": {
                "type": "SystemAssigned"
            },
            "kind": "functionapp",
            "node": {
                "workerRuntime": "node",
                "version": "~18"
            },
            "properties": {
                "clientAffinityEnabled": false,
                "httpsOnly": true,
                "publicNetworkAccess": "Enabled",
                "siteConfig": {
                    "cors": {
                        "allowedOrigins": [
                            "*"
                        ]
                    },
                    "ftpsState": "FtpsOnly",
                    "minTlsVersion": "1.2",
                    "netFrameworkVersion": "v6.0",
                    "use32BitWorkerProcess": true
                }
            }
        },
        "azHostingPlan": {
            "kind": "windows",
            "sku": {
                "name": "Y1",
                "tier": "Dynamic"
            }
        },
        "azStorageAccount": {
            "kind": "StorageV2",
            "properties": {
                "supportsHttpsTrafficOnly" : true,
                "minimumTlsVersion": "TLS1_2"
            },
            "sku": {
                "name": "Standard_LRS"
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To ensure that the correct environment config is used the '–parameters' flag can be passed into the cmd line instruction and used within the main.bicep file as a param.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`az deployment sub create --location 'centralus' --parameters 
 environmentType=dev --template-file ./main.bicep`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@description('env config types')
@allowed([
  'production'
  'test'
  'dev'
])
param environmentType string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The @allowed annotation will cause the bicep build to throw an error if a parameter is provided that is not allowed, it also notifies the user of the intended expected options. A user could easily use this template to provision a dev, test or production environment but could not use it if they wanted a UAT environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reusable resources
&lt;/h2&gt;

&lt;p&gt;To make the function app resource defined in the ./main.bicep file reusable it can be externalized into its own file, './funcationApp.bicep'. &lt;br&gt;
This file will no longer have direct access to the config which it needs to define the resources but rather have them passed into the file as params that can have their type and name defined at the top of the file.&lt;/p&gt;

&lt;p&gt;Using the storage account (azStorageAccount) defined previously, it and its params will look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@description('Storage account sku')
param azStorageAccountSkuName string
@description('Storage account kind')
param azStorageAccountKind string
@description('Storage account support Https only')
param azStorageAccountSupportsHttpsOnly bool
@description('Storage account minimum Tls Version')
param azStorageAccountMinimumTlsVersion string

@description('Storage account')
resource azStorageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
  name:  'azapp${uniqueString(resourceGroup().id)}'
  location: location
  kind: azStorageAccountKind
  sku: {
    name: azStorageAccountSkuName
  }
  properties: {
    supportsHttpsTrafficOnly: azStorageAccountSupportsHttpsOnly
    minimumTlsVersion: azStorageAccountMinimumTlsVersion
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This process can be then done for each of additional resources that are defined to complete the function app. &lt;/p&gt;

&lt;h2&gt;
  
  
  Modules
&lt;/h2&gt;

&lt;p&gt;Once the config has been externalized and there is a way to select the relevant environment config options, update the ./main.bicep file to include a module which encapsulates the resource to be deployed. This means that our main.bicep file will be easier to read and offer a way to template the deployment of our resources.&lt;/p&gt;

&lt;p&gt;Using the azStorageAccount the module will look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module funcAppModule './funcationApp.bicep' = {
name: 'funcApp'
  params: {
    location: resourceGroupLocation
    azStorageAccountKind: storageAccountConfig.kind
    azStorageAccountSupportsHttpsOnly: storageAccountConfig.properties.supportsHttpsTrafficOnly
    azStorageAccountMinimumTlsVersion: storageAccountConfig.properties.minimumTlsVersion
    azStorageAccountSkuName: storageAccountConfig.sku.name
    ...azHostingPlanParams
    ...azFunctionAppParams 
  }
  scope: resourceGroup(resourceGroupName)
  dependsOn: []
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Once completed the config used to define the values for the properties of the resources to be deployed will be contained in a .json file that can be managed and maintained by DevOps teams who understand the business best practices around deployments, costs, and naming conventions. The function app resource will now be in a separate file containing all the properties needed to create the resource but will be decoupled from any deployment config values, allowing it to be reused for any given number of deployments. The ./main.bicep file used for deploying the resource will define the parameters needed to be passed in via the cmd line and will be responsible for providing the resource with the correct config. Using this approach, dev teams can have a faster reproducible, approach to deploying needed resources that can be business approved and deployed via an automated pipeline.&lt;/p&gt;

&lt;p&gt;Source code:&lt;br&gt;
&lt;a href="https://github.com/sirBassetDeHound/bicep_function_app"&gt;https://github.com/sirBassetDeHound/bicep_function_app&lt;/a&gt;&lt;/p&gt;

</description>
      <category>azure</category>
      <category>devops</category>
      <category>bicep</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Focus on the principles and not the methodology when in an agile environment - (or just be more lean)</title>
      <dc:creator>Dan Wright</dc:creator>
      <pubDate>Thu, 24 May 2018 13:19:17 +0000</pubDate>
      <link>https://forem.com/danwright/focus-on-the-principles-and-not-the-methodology-when-in-an-agile-environment---or-just-be-more-lean-2of7</link>
      <guid>https://forem.com/danwright/focus-on-the-principles-and-not-the-methodology-when-in-an-agile-environment---or-just-be-more-lean-2of7</guid>
      <description>&lt;p&gt;I have been working in an Agile environment for about 4 years, it’s my first time working in that environment and I have come to realise that we can often become too preoccupied with the methodology and adhering to that methodology that we can forget what we were trying to solve by becoming agile. &lt;/p&gt;

&lt;p&gt;I have for the first time given a 10-minute lightning talk on this topic and thought that I would put it down in an article. &lt;/p&gt;

&lt;p&gt;The intention is to try and help those attempting to embrace agile, to  navigate through the jargon but also  remind those already working in an agile environment to take a step back and refer any changes or discussions to the agile principles, or better yet, lean principles.&lt;/p&gt;

&lt;p&gt;Recently I have been trying to introduce someone in a non-agile non-technical environment that agile will help them better manage their day to day. It has been a very worthwhile exercise for myself to better understand agile without the emphasis on software development. To do this I fell back on the 'explain it to me like I am a 5-year-old' approach, which made me think about what agile is to me, and I came up with: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;'It encourages me to remain customer focused whilst delivering a continuously increasing quality of work with less waste'&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Whilst this may seem a simplified view of agile I think it explains the reason for adopting agile quite well, on a level non-agile, non-technical people can easily get on board with.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before the methodology came the principles
&lt;/h2&gt;

&lt;p&gt;Lean really took hold in the 1930 - 1950's from the Toyota car manufacturing plant in an effort to become competitive in the industry. By looking at processes in the delivery system they realised small incremental changes could provide better less wasteful delivery. It was here where the concept of looking at flow through the system was defined, and the 5 principles of lean were developed.&lt;br&gt;
A full history of lean can be found at: &lt;a href="https://www.lean.org/WhatsLean/History.cfm" rel="noopener noreferrer"&gt;https://www.lean.org/WhatsLean/History.cfm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lean and Agile have always had a connection, the initial Agile developers had all looked towards lean for inspiration. Martin Fowler explains that Mary and Tom Poppendieck helped inspire the original agile way of thinking and its principles. Mary, working in a manufacturing plant and Tom working in software. Both being active members in the agile community shaping its direction in the 1970 - 1990's.&lt;br&gt;
For the full article by Martin fowler on this: &lt;a href="https://martinfowler.com/bliki/AgileVersusLean.html" rel="noopener noreferrer"&gt;https://martinfowler.com/bliki/AgileVersusLean.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The agile manifesto was created with 12 principles in 2001 which encourage a way of working that adapts the lean principles for software development. It is the agile manifesto that is credited as being the defacto guide to agile working supported by the 12 principles.&lt;br&gt;
The agile manifesto and the 12 principles: &lt;a href="https://www.agilealliance.org/agile101/12-principles-behind-the-agile-manifesto/" rel="noopener noreferrer"&gt;https://www.agilealliance.org/agile101/12-principles-behind-the-agile-manifesto/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the principles were in place different ways to adhere to those principles formed starting with Crystal in the early 1990's and has since gone through many changes and is adapted in many different ways, some of the more popular include, Scrum, Kanban and SAFe. &lt;/p&gt;

&lt;h2&gt;
  
  
  The principles
&lt;/h2&gt;

&lt;p&gt;Lean kit (&lt;a href="https://leankit.com/learn/lean/lean-principles/" rel="noopener noreferrer"&gt;https://leankit.com/learn/lean/lean-principles/&lt;/a&gt;) defines the 7 principles of agile as: &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Lean Principles&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Optimize the whole&lt;/td&gt;
&lt;td&gt;Create knowledge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Eliminate waste&lt;/td&gt;
&lt;td&gt;Defer commitment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Build in quality&lt;/td&gt;
&lt;td&gt;Respect people&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deliver fast&lt;/td&gt;
&lt;td&gt;--&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These 5 principles, as shown at the lean.org (&lt;a href="https://www.lean.org/WhatsLean/Principles.cfm" rel="noopener noreferrer"&gt;https://www.lean.org/WhatsLean/Principles.cfm&lt;/a&gt;) form the lean continuous learning loop:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.lean.org%2Fimages%2F5stepslean.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.lean.org%2Fimages%2F5stepslean.gif" title="lean continuous improvement loop" alt="lean continuous improvement loop"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I find these 5 principles or stages of the loop when used with the 7 lean kit principles helpful to cement the lean thinking that is needed to be 'working lean'. Identifying the value to the customer gives the constant reminder of remembering who you are providing the service for before mapping the way to achieve what the customer desires. Once understood remove all obstacles from the flow of that service ensuring that it gets to the customer in a timely waste less manner of a high quality. Establishing pull in the system drives you to validate the need for the product, ensuring that work is not done that is not needed and then meeting that demand in the timeliest way possible without creating inventory. The Kanban Methodology encourages this pull of flow through the system rather than a push of the flow, this workflow builds responsible / respectful delivery of work to the next stage in the process, rather than just 'throwing it over the fence'.&lt;/p&gt;

&lt;p&gt;The 12 agile principles as defined by the agile manifesto (&lt;a href="https://www.agilealliance.org/agile101/12-principles-behind-the-agile-manifesto/" rel="noopener noreferrer"&gt;https://www.agilealliance.org/agile101/12-principles-behind-the-agile-manifesto/&lt;/a&gt;) build upon the previous lean thinking adapting it for software development.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Agile Principles&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Our highest priority is to satisfy the customer through early and continuous delivery of valuable software&lt;/td&gt;
&lt;td&gt;Working software is the primary measure of progress.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Welcome changing requirements, even late in development. Agile processes harness change for the customer's competitive advantage.&lt;/td&gt;
&lt;td&gt;Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale.&lt;/td&gt;
&lt;td&gt;Continuous attention to technical excellence and good design enhances agility.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business people and developers must work together daily throughout the project.&lt;/td&gt;
&lt;td&gt;Simplicity--the art of maximizing the amount of work not done--is essential.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.&lt;/td&gt;
&lt;td&gt;The best architectures, requirements, and designs emerge from self-organizing teams.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The most efficient and effective method of conveying information to and within a development team is face-to-face conversation.&lt;/td&gt;
&lt;td&gt;At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behaviour accordingly.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;They promote, individuals and interactions over process and tools, working software over comprehensive documentation, customer collaboration over contract negotiation and responding to change over following a plan. To me this sounds a lot like its roots, Lean. The 12 principles in my opinion, whilst I do not disagree with the message that they are trying to deliver could be reduced. &lt;/p&gt;

&lt;p&gt;Without tackling all the principles, there are a few I wish to call out. Working software as the primary measure of progress, this principle can cause team members to become too focused with just getting 'tickets' completed and does not have any place for hypothesising, experimentation and learning. How does 'fail fast' and 'proof of concept' fall into the working software that I am to be measured by? Building projects around motivated individuals, prioritising face-to-face communication and continuous attention to detail, are 3 more principles that I consider to be good working practice of a mature software employee and possibly more a pre-requisite of a modern working environment that we should just naturally be doing.&lt;/p&gt;

&lt;p&gt;One agile principle that I think stands above all others is that, ‘the best architectures, requirements, and designs emerge from self-organising teams’. I believe this is a really important principle and one that I feel advances the lean principles, as teams we should be responsible for our own workload, prioritisation and how to achieve the goals set forth by the customer. This should be something individual teams dictate, after all it is the team that will be held accountable for tasks not being completed.&lt;/p&gt;

&lt;p&gt;To give some weight to my thoughts the agile principles are already being shrunk down, with 'modern agile' or 'heart of agile'. &lt;/p&gt;

&lt;p&gt;Modern Agile: &lt;a href="http://modernagile.org/" rel="noopener noreferrer"&gt;http://modernagile.org/&lt;/a&gt;&lt;br&gt;
Heart of Agile: &lt;a href="http://heartofagile.com/" rel="noopener noreferrer"&gt;http://heartofagile.com/&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  The problems with Methodologies
&lt;/h2&gt;

&lt;p&gt;When you have chosen to become more agile or are working in an agile way you will likely be working with an established methodology. But how do you know it’s the right one? I honestly believe that no methodology is perfect and this can often be an issue. Trying to adhere more to the scrum principles is not the same as being more agile, adhering to a methodology can often feel like you are going against the agile principle of being a self-regulating team. &lt;/p&gt;

&lt;p&gt;Methodology’s should be treated as guidelines and not things to hold people accountable for not doing the 'task' in the right way. Treating any methodology as a guideline allows for blended (agile + agile), or hybrid (agile + good idea) ways of work, ensuring teams remain flexible to their working environment and self-regulating. Working in a Kanban way but want to promote more pair programming (Extreme programming), not a problem if the methodology is a guide and not a hard and fast rule.&lt;/p&gt;

&lt;p&gt;Integration with the business or customer can be challenging if they do not know about agile and they are receiving emails, or involved in conversations about sprints, velocity, backlogs and t-shirt sizes. This lack of understanding can develop a lack of trust or confidence in those doing the work, which can turn into a lack of funding. Not talking methodologies to people and explaining without Jargon the agile reason for doing something can help build relationships, and can lead to non-agile people integrating with agile practitioners better. When we remove the focus from why we do agile to how we are doing agile we are adding a layer of abstraction between ourselves and the reasons for practising agile, we forget the motivation for doing agile and focus on the way to accomplish a task, which may not be in a very agile way.&lt;/p&gt;

&lt;h2&gt;
  
  
  So why focus on the principles?
&lt;/h2&gt;

&lt;p&gt;Agile methodologies are a tool, like a JavaScript library or an IDE, and should be used as such. With this thinking we can see that all agile tools have the same tool kit, the '5 whys', Continuous feedback loops, customer focus, Transparency, to name a few. Focusing on the idea of why we do agile, customer focus, better deliverables, reducing waste, faster delivery, we can pick the best tool for the job, and not be limited to what a methodology says. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We can be truly agile by embracing the freedom agile gives us to do our job.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Whilst I know this has not been a deep dive into agile, its methodologies and the tools we use to do its job I hope that it helps remind people that we should take a step back from what we are doing and ask ourselves 'is this decision agile'?&lt;/p&gt;

</description>
      <category>agile</category>
      <category>lean</category>
    </item>
  </channel>
</rss>
