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
Tweet

More Decks by Daron Yondem

Other Decks in Programming

Transcript

  1. Infrastructure as Code
    with Azure
    Daron Yöndem
    http://daron.me | @daronyondem

    View Slide

  2. DEMO
    ARM Templates

    View Slide

  3. View Slide

  4. Build Definition Change

    View Slide

  5. Release Definition Change

    View Slide

  6. View Slide

  7. View Slide

  8. View Slide

  9. DEMO
    Azure Portal

    View Slide

  10. View Slide

  11. View Slide

  12. View Slide

  13. Insights of an ARM Template

    View Slide

  14. View Slide

  15. VSCode Extension
    • Ctrl+P > ext install

    View Slide

  16. DEMO
    Azure CLI

    View Slide

  17. Azure Powershell vs CLI

    View Slide

  18. View Slide

  19. 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.

    View Slide

  20. 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.

    View Slide

  21. Publishing Configuration
    • Creates a ZIP File.
    • Uploaded to Storage Account
    • Set it to the machine.

    View Slide

  22. DEMO
    Azure Automation DCS

    View Slide

  23. View Slide

  24. Import DSC Configuration

    View Slide

  25. Compile Configuration

    View Slide

  26. Add VM as a Node

    View Slide

  27. Onboard any machine!
    • https://docs.microsoft.com/en-us/azure/automation/automation-
    dsc-onboarding

    View Slide

  28. 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.

    View Slide

  29. Example setting web server with DSC

    View Slide

  30. How to do it with Powershell.
    $params = @{
    AutomationAccountName = 'daronautomation'
    ResourceGroupName = 'Group'
    SourcePath = 'C:\NewTestEnvironment.ps1'
    Published = $true
    Force = $true
    }
    $null = Import-AzureRmAutomationDscConfiguration $params

    View Slide

  31. 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
    }

    View Slide

  32. 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

    View Slide

  33. For more go to EDX!
    • https://www.edx.org/course/infrastructure-code-microsoft-
    devops200-2x

    View Slide

  34. Thanks
    Daron Yöndem
    http://daron.me | @daronyondem
    All slides here; http://daron.me/decks

    View Slide