Azure-docs: Is protectedSettings a child or sibling of settings?

Created on 31 May 2018  Â·  6Comments  Â·  Source: MicrosoftDocs/azure-docs

Which of these is correct?

The first two examples use this schema:

    "settings" : {
        "protectedSettings": {},
        "publicSettings": {}
    }

But then the rest of the document uses:

    "settings" : {},
    "protectedSettings": {}

Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

assigned-to-author doc-enhancement triaged virtual-machines-windowsvc

Most helpful comment

To answer my original question:

This is correct:

    "settings" : {},
    "protectedSettings": {}

This is incorrect. It looks like the term publicSettings was copied from the C:PackagesPluginsMicrosoft.Powershell.DSC2.76.0.0RuntimeSettings0.settings file created on the target VM, but is not valid here.

    "settings" : {
        "protectedSettings": {},
        "publicSettings": {}
    }

Working Example:

In the end, I was able to successfully deploy the DSC Extension using the following template.json file. Note, I removed the dependsOn because my VM is already deployed in a different template.

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "VMName": {
      "type": "string"
    },
    "registrationUrl1": {
      "type": "string"
    },
    "registrationKey1": {
      "type": "securestring"
    },
    "nodeConfigurationName": {
      "type": "string"
    }
  },
  "variables": {
  },
  "resources": [
    {
      "type": "Microsoft.Compute/virtualMachines/extensions",
      "name": "[concat(parameters('VMName'),'/Microsoft.Powershell.DSC')]",
      "apiVersion": "2017-12-01",
      "location": "[resourceGroup().location]",
      "dependsOn": [       
      ],
      "properties": {
        "publisher": "Microsoft.Powershell",
        "type": "DSC",
        "typeHandlerVersion": "2.76",
        "autoUpgradeMinorVersion": true,
        "settings": {
          "configurationArguments": {
            "RegistrationUrl": "[parameters('registrationUrl1')]",
            "NodeConfigurationName": "[parameters('nodeConfigurationName')]"
          }
        },
        "protectedSettings": {
          "configurationArguments": {
            "RegistrationKey": {
              "UserName": "PLACEHOLDER_DONOTUSE",
              "Password": "[parameters('registrationKey1')]"
            }
          }
        }
      }
    }
  ],
  "outputs": {
  }
}

All 6 comments

@mjcarrabine Thanks for the question! We are investigating and will update you shortly.

It depends on what you are putting into the brackets.

If you look at this section: https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/dsc-template#settings-vs-protectedsettings

It explains the difference between settings and protected settings.

@MicahMcKittrick-MSFT and @DCtheGeek.

In its current state, this article should have all of its examples removed until they are corrected and clarified as to which schema is being used for each. They do not support the words on the page, and the number of errors make them counter-productive.

1. Update the schema hosted at https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json# and on GitHub.

  • There should be an article documenting the published hosted json schema.
  • If there are 2 schemas:

    • Publish the new json schema so our template.json files will validate correctly,

    • Either split this article into 2 separate articles or clearly identify the schema used on each individual example.

2. Correct the examples on this page:

@mjcarrabine thanks so much for those examples! I will work with the content author to review and ensure the doc is correct.

@DCtheGeek can you take a look?

To answer my original question:

This is correct:

    "settings" : {},
    "protectedSettings": {}

This is incorrect. It looks like the term publicSettings was copied from the C:PackagesPluginsMicrosoft.Powershell.DSC2.76.0.0RuntimeSettings0.settings file created on the target VM, but is not valid here.

    "settings" : {
        "protectedSettings": {},
        "publicSettings": {}
    }

Working Example:

In the end, I was able to successfully deploy the DSC Extension using the following template.json file. Note, I removed the dependsOn because my VM is already deployed in a different template.

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "VMName": {
      "type": "string"
    },
    "registrationUrl1": {
      "type": "string"
    },
    "registrationKey1": {
      "type": "securestring"
    },
    "nodeConfigurationName": {
      "type": "string"
    }
  },
  "variables": {
  },
  "resources": [
    {
      "type": "Microsoft.Compute/virtualMachines/extensions",
      "name": "[concat(parameters('VMName'),'/Microsoft.Powershell.DSC')]",
      "apiVersion": "2017-12-01",
      "location": "[resourceGroup().location]",
      "dependsOn": [       
      ],
      "properties": {
        "publisher": "Microsoft.Powershell",
        "type": "DSC",
        "typeHandlerVersion": "2.76",
        "autoUpgradeMinorVersion": true,
        "settings": {
          "configurationArguments": {
            "RegistrationUrl": "[parameters('registrationUrl1')]",
            "NodeConfigurationName": "[parameters('nodeConfigurationName')]"
          }
        },
        "protectedSettings": {
          "configurationArguments": {
            "RegistrationKey": {
              "UserName": "PLACEHOLDER_DONOTUSE",
              "Password": "[parameters('registrationKey1')]"
            }
          }
        }
      }
    }
  ],
  "outputs": {
  }
}

@mjcarrabine Sorry for the delay. The complete update to this article will get published tomorrow. If you feel something is still incorrect or missing, feel free to re-open this Issue or create a new one. Thank you again for your feedback!

Was this page helpful?
0 / 5 - 0 ratings