Skip to content
  • Blog
  • Events
  • Help
  • Careers
  • Contact
New Signature
  • About
      • Company

        Cognizant Microsoft Business Group is dedicated to changing the way businesses innovate, transform and run based on a unique cloud operating model. You will now be redirected to our new microsite to learn more.

        View Company

      • Awards

        As a company, we are regularly recognized within the IT industry as well as the communities we serve.

        View All Awards
      • News

        Read the most up-to-date corporate announcements, Microsoft technology updates, innovative business solutions and learn more about how the Cognizant Microsoft Business Group can take your business even farther.

        View News

      • Partners

        New Signature works with a number of outstanding technology companies to deliver the best experiences to our customers.

        View Partners
      • Leadership

        Cognizant Microsoft Business Group’s executive team is comprised of innovative leaders with proven experience and deep industry expertise. You will now be redirected to our new microsite to learn more.

        View Leadership

      • Industries

        Our solutions are tailored to empower organizations across a wide range
        of industries.

        View Industry Experience
    Close
  • Solutions
      • Intelligent Enterprise
        Solutions

        Going Digital
        Unleash cloud capability, deliver change and compete at speed with a Microsoft digital operating model, enabling you to work more efficiently as you transform your IT environment. Learn More

      • Featured Solution

        Secure Cloud
        In a world of constant threat, ensuring that your underlying cloud platform is protected is the first step on your organization’s journey towards a secure, compliant operating environment. Learn More
      • Intelligent Workplace
        Solutions

      • Secure Workplace

        Work Anywhere

        Endpoint Health

        Identity Health

        Teamwork Support



        VIEW WORKPLACE SOLUTIONS
      • Intelligent Cloud
        Solutions

      • App Factory

        Azure Accelerator

        Azure Launchpad

        Azure Launchpad for DevOps

        Application Health

        Platform Health

        VIEW ClOUD SOLUTIONS
    Close
  • Services
      • Begin your journey towards becoming a digital business with GO, our unique end-to-end framework based on the Microsoft Cloud Adoption Framework.

        GO DIGITAL OPERATING MODEL
      • Intelligent Enterprise

      • Consulting

        We go beyond just technology to help your organization understand how digital can help you uniquely differentiate and better serve your employees and customers.

        VIEW ENTERPRISE SERVICES
      • Intelligent Workplace

        • Identity

          Identity is your new first-line-of-defense. It’s vital to your users and clients that your identity platform is properly configured and secured.

          Endpoint

          Whether your devices are on-premises or remote, personal or business-owned, we can ensure they are properly managed and protected.

          Teamwork

          Today’s workforce is collaborating than ever before.  We can empower your current teams with tomorrow’s progressive technologies.

          VIEW WORKPLACE SERVICES
        • Intelligent Cloud

          • Platform

            The cloud is no longer some future-state. It’s the here and now. Adopting a cloud-first platform is one of the best ways to maintain a future-proofed competitive advantage.

            Applications

            We build cloud-native apps and modernize legacy systems with the power of Azure to give your organization a competitive edge.

            Data

            We can help your organization create secure, scalable data platforms to deliver simpler and more sophisticated insights to your business.

            VIEW CLOUD SERVICES
        Close
      • Client Stories
          • Case Studies

            Browse a comprehensive list of companies who have created successful partnerships and experienced transformative solutions with New Signature.

            View All Case Studies

          • Featured Case Study TalkTalk Modern Workplace

            New Signature worked with TalkTalk to define a new Modern Workplace solution based on Microsoft 365, which kept the user firmly at the center of the transformation.
            View Case Study

          • Testimonials

            We love transforming our customers businesses, take a look at what they have to say about New Signature.

            View Testimonials

          • Featured Testimonial Davis Construction

            With New Signature’s help, Davis was able to take a progressive step forward by migrating their private branch exchange (PBX) phone system to a Voice of Internet Protocol (VoIP) system.
            View Testimonial

        Close
      • Explore
          • Guides & Ebooks

            Dive deeper into education with your team by leveraging our expert-developed guides and eBooks.

            View All Guides & Ebooks

          • Infographics

            Rich with statistics and information, our infographics are great tools for quick but insightful learning.

            View All Infographics
          • Podcast: Office Explorers

            Join Kat and Rob monthly as they chat with New Signature experts and explore the world of O365.

            Listen to Podcasts

          • Videos

            Visit our videos stream to access recorded webinars, service information and to learn more about us.

            WATCH ALL VIDEOS
          • Flyers

            Searching for information about our services? Our flyers are a great takeaway for all those details.

            VIEW ALL FLYERS

          • Featured Stream

            Learn more about the tooling and expertise required to unlock productivity and mobilize your teams.

            MODERN WORKPLACE
        Close
        Close
      Blog

      The Need for ARM Template Parameter Files

      New Signature / Blog / The Need for ARM Template Parameter Files
      April 30, 2020April 27, 2020| New Signature

      I was recently involved in a mid-scale deployment for a customer, who unfortunately didn’t have Azure DevOps. They already had their own ARM Templates and they wanted their 2nd/3rd Line infrastructure team to be able to deploy their infrastructure in one go and with little effort to different environments instead of individually, without using linked templates or modifying the original templates.

      I began by firstly analyzing their ARM code and noticed that they had hundreds of ARM Templates and parameter files all over the shop. It was extremely confusing to figure out what was doing what, and there was a non-existent naming convention as well. The solution had to be simple, require little modifications to the script and also had to deploy what was requested.

      Having a single Deployment Script (written in PowerShell) was the most efficient way possible, as this would call multiple ARM Templates sitting in blob storage and deploy them at will, creating each deployment in a function and then “hashing” out any resources not need.

      I began modifying their ARM code, being sure to standardize each parameter carefully (e.g. VirtualNetworkName, instead of vnetname). For this to work efficiently and be seamless, all parameters in all templates had to rely on the same name.

      Once that task was done, I then uploaded the templates into private-access blob storage.

      I then started scripting the core deployment script which will deploy all the templates hosted in the secure blob. It first generates a SAS Token which is then passed into the core deployment script. Each ARM template has string-based parameters which I’m passing using the PowerShell Parameter Object file which uses a HashTable.

      This has now dramatically reduced the number of Parameter Files to zero and the main parameters like “location, resourcegroupname virtualnetworkname etc” because we’re passing them in a single core deployment script.

      To provide a real-life scenario, I’ve got a demo script below which will deploy a storage account to an existing resource group. Granted, deploying one of them is simple, but consolidating a full deployment into one script you can see the extreme benefits is more difficult without Azure DevOps.

      First, we map out our parameters. They are pretty self-explanatory, so I won’t go into much detail around them.

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      [CmdletBinding()]
      Param
      (
      [Parameter(Mandatory=$false)]
      [ValidateNotNullOrEmpty()]
      [string]$location = "West Europe",
      [Parameter(Mandatory=$false)]
      [ValidateNotNullOrEmpty()]
      [string]$ResourceGroupName = "RG-Storage",
      [Parameter(Mandatory=$false)]
      [ValidateNotNullOrEmpty()]
      [string]$storageaccounttype = "Standard_LRS",
      [Parameter(Mandatory=$false)]
      [ValidateNotNullOrEmpty()]
      [string]$storageaccountname = "storsacccraig003",
      [Parameter(Mandatory=$false)]
      [ValidateNotNullOrEmpty()]
      [string]$artifactsstoragename = "cloudshellcraig001",
      [Parameter(Mandatory=$false)]
      [ValidateNotNullOrEmpty()]
      [string]$artifactscontainer = "artifacts"
      )

      Next, we need to extrapolate the parameters from the main ARM template. Retrieving this requires PowerShell Core 6 (because it uses the switch “-AsHashtable”) or you could copy and paste them from the JSON file (but that’s tedious),

      You need to locate your ARM template code and pop it into a variable, then include the Convert-From-Json cmdlet, which will do exactly what it says with that switch at the end “-AsHashTable” the properties which you need to retrieve are the .parameters.Keys

      1
      2
      3
      4
      5
      $TemplateFileText = [System.IO.File]::ReadAllText("C:\Users\repos\Storage\azuredeploy_storage.json")
      $TemplateObject = ConvertFrom-Json $TemplateFileText -AsHashtable
      $TemplateObject.parameters.Keys

      We then get back the output displayed below:

      1
      2
      3
      Location
      StorageAccountName
      StorageAccountType

      This now can be used in our deployment script, but we need to add some extra functions for this to be able to work with the ARM template, which will look something like this:

      1
      2
      3
      4
      5
      $storageparams =@{
          location = $location
          StorageAccountName = $storageaccountname
          StorageAccountType = $storageaccounttype
      }

      The $storageparams variable is our -TemplateParameterObject switch, which will be defined when we run the New-AzResourceGroupDeployment cmdlet.

      The extrapolated strings from the previous command can now be included in the body of the $storageparams equalling the parameter variables at the very top of our script $location $storageaccountname & $storageaccounttype variables are all in the parameters at the top.

      We then create the main function, which will generate the SAS Token and deploy the Storage ARM Template.

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      Function DeployStorage {
          $StorageAccountContext = (Get-AzStorageAccount | Where-Object{$_.StorageAccountName -eq $artifactsstoragename}).Context
          $StartTime = Get-Date
          $EndTime = (Get-Date).AddHours(2)
          $sas = New-AzStorageBlobSASToken -Container $artifactscontainer `
              -Blob "azuredeploy_Storage.json" `
              -Context $StorageAccountContext `
              -Permission "r" `
              -StartTime $StartTime `
              -ExpiryTime $EndTime `
              -FullUri
          Start-Sleep -Seconds 2 # This is so the SAS Token Generation has time to output correctly
          $DeploymentName = "DeployStorage01"
          $templateFileLoc = $sas
          New-AzResourceGroupDeployment -ResourceGroupName $ResourceGroupName -Name $DeploymentName -TemplateUri $templateFileLoc -TemplateParameterObject $storageparams -Verbose
      }

      You can see in the function that the variables are all being called in the parameters at the top of our script, and the switch -TemplateParameterObject is pointing to the $storageparams.

      If you had a virtual machine with the same parameter values like “Virtual Network Name”, you can see it’s minimizing the amount of code and also removing the .parameters JSON file.

      This method was a nice test case for me which is now live and rocking in the client’s environment. It would greatly improve, as well,  if the client had Azure DevOps.

      Thank you for reading and I hope you found this blog post helpful. You can find the full code below for your use:

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      [CmdletBinding()]
      Param
      (
          [Parameter(Mandatory=$false)]
          [ValidateNotNullOrEmpty()]
          [string]$location = "West Europe",
          [Parameter(Mandatory=$false)]
          [ValidateNotNullOrEmpty()]
          [string]$ResourceGroupName = "RG-Storage",
          [Parameter(Mandatory=$false)]
          [ValidateNotNullOrEmpty()]
          [string]$storageaccounttype = "Standard_LRS",
          [Parameter(Mandatory=$false)]
          [ValidateNotNullOrEmpty()]
          [string]$storageaccountname = "storsacccraig003",
          [Parameter(Mandatory=$false)]
          [ValidateNotNullOrEmpty()]
          [string]$artifactsstoragename = "cloudshellcraig001",
          [Parameter(Mandatory=$false)]
          [ValidateNotNullOrEmpty()]
          [string]$artifactscontainer = "artifacts"
      )
      ################# Storage Template Parameters ##################################
      $storageparams =@{
          location = $location
          StorageAccountName = $storageaccountname
          StorageAccountType = $storagetype
      }
      ################# Storage Deployment ##################################
      Function DeployStorage {
          % {Write-Host ""}
          Write-Host "Generating SAS Token for Storage Template..." -ForegroundColor Yellow;
          % {Write-Host ""}
          $StorageAccountContext = (Get-AzStorageAccount | Where-Object{$_.StorageAccountName -eq $artifactsstoragename}).Context
          $StartTime = Get-Date
          $EndTime = (Get-Date).AddHours(2)
          $pwd = New-AzStorageBlobSASToken -Container $artifactscontainer `
              -Blob "azuredeploy_Storage.json" `
              -Context $StorageAccountContext `
              -Permission "r" `
              -StartTime $StartTime `
              -ExpiryTime $EndTime `
              -FullUri
          Start-Sleep -Seconds 2
          % {Write-Host ""}
          Write-Host "Deploying Storage Account..." -ForegroundColor Yellow;
          % {Write-Host ""}
          $DeploymentName = "DeployStoragedeployment01"
          $templateFileLoc = $pwd
          New-AzResourceGroupDeployment -ResourceGroupName $ResourceGroupName -Name $DeploymentName -TemplateUri $templateFileLoc -TemplateParameterObject $storageparams -Verbose
      }
      DeployStorage
      Categories
      Technical Reviews
      Contact New Signature

      Blog Posts

      • Agile Delivery for Large Scale Data Ingestion using Azure Data Explorer
      • Implementing Cloud Adoption Framework Across Vida Homeloan’s Organization
      • Cognizant Microsoft Business Group Achieves Microsoft Advanced Specialization for Windows Virtual Desktop
      • Cognizant’s Experience Lab for Continuous Testing with Azure

      Managed Services

      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent fermentum, enim ac dignissim aliquet

      VIEW ALL MANAGED SERVICES

      Professional Services

      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent fermentum, enim ac dignissim aliquet

      VIEW ALL PROFESSIONAL SERVICES

      New Signature

      About

      • Company
      • Awards
      • News
      • Leadership
      • Partners
      • Industries

      Solutions

      • Intelligent Enterprise Solutions
      • Intelligent Workplace Solutions
      • Intelligent Cloud Solutions

      Services

      • GO
      • Intelligent Enterprise
      • Intelligent Workplace
      • Intelligent Cloud

      Client Stories

      • Client Stories
      • Testimonials

      Explore

      • Guides & Ebooks
      • Podcasts
      • Flyers
      • Infographics
      • Videos
      Copyright © 2023 New Signature
      • Blog
      • Events
      • Careers
      • Help
      • Anti Slavery
      • Privacy Policy
      • Contact
      • About
        • Company
        • Awards
        • News
        • Leadership
        • Partners
        • Industries
      • Services
        • GO
        • Intelligent Enterprise
        • Intelligent Workplace
        • Intelligent Cloud
      • Client Stories
        • Case Studies
        • Testimonials
      • Technologies
      • Explore
        • Guides & Ebooks
        • Infographics
        • Podcast: Office Explorers
        • Videos
        • Flyers
      • Blog
      • Events
      • Careers
      • Contact
      • Search
      Cookie Settings
      New Signature uses "Required Cookies" to run our website, "Functional Cookies" used by third parties to personalise marketing, including social media features.

      Change your preferences by clicking the “Cookie Settings” link at the bottom of every page. Learn more about cookies in our Cookie Policy and our Privacy Policy. By clicking the “Accept Cookies” button below, you consent to our use of cookies.

      Please note that “Required Cookies” will be set regardless of your consent.
      Cookie SettingsAccept Cookies
      Privacy & Cookies Policy

      Privacy Overview

      This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
      Targeting

      Targeting Cookies are used to capture user information in order for New Signature to deliver better user experiences.

      Performance

      Performance Cookies provide Content Delivery Network assets that deliver faster site content delivery capabilities.

      Required

      These cookies are required mainly in order to deliver Multilanguage site capabilities.

      Functional

      Functional Cookies allow us to provided advanced media capabilities including videos, surveys and other multimedia capabilities.

      Disabling Functional cookies will block the playing of videos and other multimedia site components.

      Save & Accept