2

This has been asked before, but at the rate things change in Azure, I'm asking again to see if there is a way forward. I believe this is the SO way.

Rather than use the DSC VM extension nested under the VM deployment, I prefer to "register" the node under DSC in an Automation Account. To do so I am following the quick start template: VM-DSC-Extension-Azure-Automation-Pull-Server

In my automation account, I have several configurations. Is it possible to apply multiple configurations from one template' resource?

I believe I can only have one NodeConfigurationName under resource type:

"Microsoft.Compute/virtualMachines/extensions" > properties.settings.properties.name

Is it a case of copying the whole resource block for each DSC configuration or should I be thinking of creating a "merged" config? (doesn't seem very portable).

woter324
  • 2,608
  • 5
  • 27
  • 47

3 Answers3

0

i don't think this changed, also, if you are talking about Azure Automation this is really impossible, because ARM Template registers the VM to the configuration and doesn't wait for it to converge, so there is no way for you to track if the VM is converged from the template.

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
0

The short answer to the question is that no, you cannot apply "multiple configurations" in powershell DSC. It is meant to have a configuration per node. That being said, you can use the following in Azure Automation to help build composite templates (IE: configuration that points at other more modular units of configuration that you have created).

You can use composite resources in Azure Automation. Essentially you would create a custom module based on the article and then upload that to your Automation account.

Once there, you can reference that configuration in your DSC node configurations.

    Configuration AssertDefault{
        Import-DSCResource -ModuleName <name> -ModuleVersion <Version>
        Node $AllNodes.Where($_.NodeName -eq "BaseServer"}.NodeName{
           <<your configuration>> BaseServer{
                // your parameters
           }
        }
     }
CtrlDot
  • 2,463
  • 14
  • 11
  • I'm a bit slow on the DSC uptake. Sorry. So one would write one "configuration" to "describe" how one or more servers should be. These will be identical. Using @CtrlDot's example, one can write a DSC resources to do X and another to do Y, then in the configuration, call these resources, selectively applying them, using the where filter. I guess this is not best practice. IMHO, either way will result in a plethora of long configuration files for the various servers. Perhaps, DSC for the base + Custom Script Extensions for the configuration e.g. SQL server. – woter324 May 30 '17 at 22:50
  • I don't think I agree. There are consequences against the custom script extension as well. DSC is declarative and using composite you can abstract the complexity in a module, and apply it as needed to your server classes. – CtrlDot May 30 '17 at 23:33
0

From Azure Portal you can not add multiple DSC to one node.