Templates/AzureDSCPullConfig.ps1
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# The DSC configuration that will generate metaconfigurations [DscLocalConfigurationManager()] Configuration DscMetaConfigs { param ( [Parameter(Mandatory=$True)] [String]$RegistrationUrl, [Parameter(Mandatory=$True)] [String]$RegistrationKey, [Parameter(Mandatory=$True)] [String[]]$ComputerName, [Int]$RefreshFrequencyMins = 30, [Int]$ConfigurationModeFrequencyMins = 15, [String]$ConfigurationMode = "ApplyAndMonitor", [String]$NodeConfigurationName, [Boolean]$RebootNodeIfNeeded= $False, [String]$ActionAfterReboot = "ContinueConfiguration", [Boolean]$AllowModuleOverwrite = $False, [Boolean]$ReportOnly ) if(!$NodeConfigurationName -or $NodeConfigurationName -eq "") { $ConfigurationNames = $null } else { $ConfigurationNames = @($NodeConfigurationName) } if($ReportOnly) { $RefreshMode = "PUSH" } else { $RefreshMode = "PULL" } Node $ComputerName { Settings { RefreshFrequencyMins = $RefreshFrequencyMins RefreshMode = $RefreshMode ConfigurationMode = $ConfigurationMode AllowModuleOverwrite = $AllowModuleOverwrite RebootNodeIfNeeded = $RebootNodeIfNeeded ActionAfterReboot = $ActionAfterReboot ConfigurationModeFrequencyMins = $ConfigurationModeFrequencyMins } if(!$ReportOnly) { ConfigurationRepositoryWeb AzureAutomationDSC { ServerUrl = $RegistrationUrl RegistrationKey = $RegistrationKey ConfigurationNames = $ConfigurationNames } ResourceRepositoryWeb AzureAutomationDSC { ServerUrl = $RegistrationUrl RegistrationKey = $RegistrationKey } } ReportServerWeb AzureAutomationDSC { ServerUrl = $RegistrationUrl RegistrationKey = $RegistrationKey } } } # Create the metaconfigurations # TODO: edit the below as needed for your use case $Params = @{ RegistrationUrl = '<fill me in>'; RegistrationKey = '<fill me in>'; ComputerName = @('<some VM to onboard>', '<some other VM to onboard>'); NodeConfigurationName = 'SimpleConfig.replace'; RefreshFrequencyMins = 30; ConfigurationModeFrequencyMins = 15; RebootNodeIfNeeded = $False; AllowModuleOverwrite = $False; ConfigurationMode = 'ApplyAndMonitor'; ActionAfterReboot = 'ContinueConfiguration'; ReportOnly = $False; # Set to $True to have machines only report to AA DSC but not pull from it } |