Azure / Azure/azure-quickstart-templates

Cannot convert value to type System.String.

Open
#2,184 0 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

### dsc-extension-iis-server-windows-vm

https://github.com/Azure/azure-quickstart-templates/tree/master/dsc-extension-iis-server-windows-vm
### Issue Details

DSC gives the following error during deployment in Azure:

**Cannot process argument transformation on parameter 'ConfigurationFunction'. Cannot
convert value to type System.String.**

Other parameters are working fine and when I hardcode the following text in the JSON template, it works fine: "IISWebsite.ps1\IISWebsite"

I use the JSON file in the following way:
- PowerShell Runbook 1: The user runs this runbook that runs two other runbooks:
- PowerShell Runbook 1.1: Create a Resource Group. This script creates a new resource group
- PowerShell Runbook 1.2: Create a VM with DSC extension. This script uses the JSON template.

So the user provides the value of the parameter in Azure at Runbook 1:

```
# Choose the Configuration Function
[Parameter(Mandatory=$true)]
[String]$configurationFunction,
```

That goes to Runbook 1.2:

```
# Choose the Configuration Function
[Parameter(Mandatory=$true)]
[String]$configurationFunction,
```

To the following JSON parameter:

```
"configurationFunction": {
"type": "string",
"defaultValue": "IISWebsite.ps1\\IISWebsite",
"metadata": {
"description": "DSC configuration function to call"
}
},
```

To configure the DSC properties in the JSON template:

```
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.19",
"settings": {
"ModulesUrl": "[parameters('modulesUrl')]",
"ConfigurationFunction": "[parameters('configurationFunction')]",
"Properties": {
"MachineName": "[parameters('vmName')]"
}
},
"protectedSettings": null
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the dsc-extension-iis-server-windows-vm template and trace configurationFunction from PowerShell Runbook 1 through Runbook 1.2 into the JSON DSC settings. Compare the parameterized value with the hardcoded IISWebsite.ps1\\IISWebsite value and reproduce the deployment error. Done means identifying why the parameter is not accepted as a string and documenting or correcting the template flow.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.