Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Infrastructure As Code

Infrastructure As Code

Infrastructure deployments with IaC are repeatable and prevent runtime issues caused by configuration drift or missing dependencies. DevOps teams can work together with a unified set of practices and tools to deliver applications and their supporting infrastructure rapidly, reliably, and at scale. In this session we will look into topics like Azure Automation, Desired State Configuration, ARM Templates.

Daron Yondem

October 26, 2017

More Decks by Daron Yondem

Other Decks in Programming


  1. What is PowerShell DSC • Is a new configuration management

    platform. It does not go against Chef or puppet. It works with them. • Enables deployment of configuration data. • Fixes a configuration that has drifted away from the desired state.
  2. VM Agents and Extensions • Azure VM Agent is a

    secured, light-weight process that runs extensions. • VMAccessAgent, DSC, ChefClient, DockerExtension • Azure Powershell DSC Extension does the job for DSC.
  3. Publishing Configuration • Creates a ZIP File. • Uploaded to

    Storage Account • Set it to the machine.
  4. How to write configurations? • The Configuration block. This is

    the outermost script block. You define it by using the Configuration keyword and providing a name. • One or more Node blocks. These define the nodes (computers or VMs) that you are configuring. In the above configuration, there is one Node block that targets a computer named "TEST-PC1". • One or more resource blocks. This is where the configuration sets the properties for the resources that it is configuring. In this case, there are two resource blocks, each of which call the "WindowsFeature" resource.
  5. How to do it with Powershell. $params = @{ AutomationAccountName

    = 'daronautomation' ResourceGroupName = 'Group' SourcePath = 'C:\NewTestEnvironment.ps1' Published = $true Force = $true } $null = Import-AzureRmAutomationDscConfiguration $params
  6. DSC Compilation $compParams = @{ AutomationAccountName = 'daronautomation' ResourceGroupName =

    'Group' ConfigurationName = 'NewTestEnvironment' } $CompilationJob = Start-AzureRmAutomationDscCompilationJob @compParams ## Wait for the DSC compile while($CompilationJob.EndTime -eq $null -and $CompilationJob.Exception -eq $null) { $CompilationJob = $CompilationJob | Get-AzureRmAutomationDscCompilationJob Start-Sleep -Seconds 3 }
  7. Attach it to the VM $nodeId = (Get-AzureRmAutomationDscNode -AutomationAccountName 'daronautomation'

    - ResourceGroupName 'Group' -Name 'YourVMName').Id $nodeParams = @{ NodeConfigurationName = "NewTestEnvironment.TEST" ResourceGroupName = 'Group' Id = $nodeId AutomationAccountName = 'daronautomation' Force = $true } $node = Set-AzureRmAutomationDscNode @nodeParams