Azure / Azure/azure-quickstart-templates

101-automation-configuration issue

Open
#4,251 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
14.9k
Forks
16.2k
Avg merge
6d 21h
Merged PRs (30d)
6

Description

[101-automation-configuration issue][https://github.com/Azure/azure-quickstart-templates/tree/d663d5eb0245d72da0eee766a81bc3650ed53da1/101-automation-configuration](https://github.com/Azure/azure-quickstart-templates/tree/d663d5eb0245d72da0eee766a81bc3650ed53da1/101-automation-configuration)

### Issue Details
I don't believe this template has been merged yet. I have been trying to reach @mgreenegit on [PowerShell.org](https://powershell.org/forums/topic/cattle-options-when-the-nodename-is-unknown/). Please assign to @mgreenegit (if appropriate).

Referring to @mgreenegit example "[provisionConfiguration.json](https://github.com/Azure/azure-quickstart-templates/blob/d663d5eb0245d72da0eee766a81bc3650ed53da1/101-automation-configuration/nested/provisionConfiguration.json)"

### Issue 1 ###
In your example template, `variables.dscConfigurations.DomainControllerConfig.compileName = "[guid(resourceGroup().id, deployment().name)]"` This creates the same name each time the deployment is run, therefore, if multiple deployments are run in the same resource group, it fails.

My workaround is to create a random name for each deployment:
```
$uniqueName = ([guid]::NewGuid().guid).split("-")[4]

New-AzureRmResourceGroupDeployment `
-Name "TestTemplate-$uniqueName" `
```
I guess the idea is that one resource group only needs one deployment to be run once, however, it makes testing rather awkward and the rest of the stack allows for "redeployment" so it's a shame that this limits it. I've looked up [guid](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-string#guid), but cannot find an appropriate scope. uniqueString won't work either as it has similar scoping issues. Looks like we need a totally random GUID scope.

### Issue 2 ###
In your example template, resource type "configurations" properties.overwrite = "true",
This resource publishes the DSC configuration to AA, however, the overwrite doesn't seem to do anything. For one, in Resource Explorer, it's not listed as a property and secondly, configurations are not updated. If I change a configuration, the change is not reflected.

The workaround is to delete the whole configuration. I did not experience this issue when using the PowerShell cmdlet `Import-AzureRmAutomationDscConfiguration`. There is a `-Force` parameters that overwrites existing configurations. I'm not sure which API property this pertains to, but as I said there is no reference to `overwrite` in previously imported configurations.

### Issue 3 ###
If a deployment fails the `New-AzureRmResourceGroupDeployment` keeps running. It appears the cmdlet never gets feedback that the template deployment has failed. It may be because I have had to nest the template as my automation account is in a different resource group to the one referenced in `New-AzureRmResourceGroupDeployment`. However, if I drill into the deployment via the portal and cancel the nested template, the next time I run `New-AzureRmResourceGroupDeployment`, I get an error that there is already a deployment (of the same name) in progress, due to expire in a few days!

The workaround is to add a random GUID to the child template's name.

I understand these issue are more to do with the underlying Azure architecture than this template, however, I understand @mgreenegit is well placed to guide / rectify. Also, I feel these issues are real-world issues that developers will face when using the template, so even if not fixable, perhaps they can be added to the template's documentation as limitations.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with 101-automation-configuration/nested/provisionConfiguration.json and inspect variables.dscConfigurations.DomainControllerConfig.compileName and the configurations resource's overwrite property. Reproduce the behavior with New-AzureRmResourceGroupDeployment, including a failed nested deployment, and compare it with Import-AzureRmAutomationDscConfiguration. Done means the behavior is corrected or its confirmed limitations are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cloud, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.