Error when invoking DSC module #4765
-
|
receiving the following when invoking DSC module: |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
|
please share the part of your Bicep file that includes the VM DSC extension in push mode with the parameters. It will look something like the following The parameters there, have to match what is in the DSC configuration. i.e. the configuration in the zip file. they will look something like this notice how what is in my dsc extension in bicep matches what I have in my powershell configuration. configurationArguments: {
DomainName: Global.ADDomainName
Thumbprint: Global.certificateThumbprint
storageAccountId: saaccountidglobalsource.id
deployment: Deployment
networkid: '${networkId}.'
appInfo: (contains(vm, 'AppInfo') ? string(vm.AppInfo) : '')
DataDiskInfo: string(VM[index].DataDisk)
clientIDLocal: '${Environment}${DeploymentID}' == 'G0' ? '' : UAILocal.properties.clientId
clientIDGlobal: '${Environment}${DeploymentID}' == 'G0' ? '' : UAIGlobal.properties.clientId
}
configurationData: {
url: '${Global._artifactsLocation}/ext-CD/${vm.Role}-ConfigurationData.psd1'
}
}
protectedSettings: {
configurationArguments: {
AdminCreds: {
UserName: Global.vmAdminUserName
Password: vmAdminPassword
}
sshPublic: {
UserName: 'ssh'
Password: sshPublic
}
devOpsPat: {
UserName: 'pat'
Password: devOpsPat
}
}
configurationUrlSasToken: Global._artifactsLocationSasToken
configurationDataUrlSasToken: Global._artifactsLocationSasToken
}$Configuration = 'AppServers'
Configuration $Configuration
{
Param (
[String]$DomainName,
[PSCredential]$AdminCreds,
[PSCredential]$sshPublic,
[PSCredential]$devOpsPat,
[Int]$RetryCount = 30,
[Int]$RetryIntervalSec = 120,
[String]$ThumbPrint,
[String]$StorageAccountId,
[String]$Deployment,
[String]$NetworkID,
[String]$AppInfo,
[String]$DataDiskInfo,
[String]$clientIDLocal,
[String]$clientIDGlobal,
[switch]$NoDomainJoin
)if you are able to share this in a public repo that will be better, since I would prefer not to open up zip files on my computer. Or else please share relevant parts or the code. i.e. the parameters section from the DSC config. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
note this is what you have resource vmName_vmExtensionName 'Microsoft.Compute/virtualMachines/extensions@2019-12-01' = {
dependsOn: [
virtualMachines_MIM_DC_01_name_resource
]
parent: virtualMachines_MIM_DC_01_name_resource
name: 'CreateADForest'
location: location
properties: {
publisher: 'Microsoft.Powershell'
type: 'DSC'
typeHandlerVersion: '2.19'
autoUpgradeMinorVersion: true
settings: {
//ModulesUrl: uri('${artifactsLocation}/DSC/CreateADPC.zip', '${moduleFilePath}${artifactsLocationSasToken}')
//ModulesUrl: uri('${artifactsLocation}/${moduleFilePath}', '${moduleFilePath}${artifactsLocationSasToken}')
//ModuleUrl: uri('https://dev.azure.com/jobothw/_git/Templates?path=/DSC/CreateADPDC.zip', '${moduleFilePath}${artifactsLocationSasToken}')
ModuleUrl: uri('https://dev.azure.com/jobothw/_git/Templates', '?path=/DSC/CreateADPDC.zip')
ConfigurationFunction: configurationFunction
Properties: {
DomainName: domainName
Admincreds: {
UserName: adminUsername
Password: 'PrivateSettingsRef:AdminPassword'
}
MachineName: vmName
}
}
protectedSettings: {
Items: {
adminPassword: adminPassword
}
}
}
}This was my reference resource VMDSC 'Microsoft.Compute/virtualMachines/extensions@2021-03-01' = [for (vm, index) in AppServers: if (VM[index].match && VM[index].Extensions.DSC == 1 && vm.Role != 'PULL' && ! (DeploymentName == 'ConfigSQLAO' || DeploymentName == 'CreateADPDC' || DeploymentName == 'CreateADBDC')) {
name: 'Microsoft.Powershell.DSC'
parent: virtualMachine[index]
location: resourceGroup().location
properties: {
publisher: ((OSType[vm.OSType].OS == 'Windows') ? 'Microsoft.Powershell' : 'Microsoft.OSTCExtensions')
type: ((OSType[vm.OSType].OS == 'Windows') ? 'DSC' : 'DSCForLinux')
typeHandlerVersion: ((OSType[vm.OSType].OS == 'Windows') ? '2.24' : '2.0')
autoUpgradeMinorVersion: true
forceUpdateTag: deploymentTime
settings: {
wmfVersion: 'latest'
configuration: {
url: '${Global._artifactsLocation}/ext-DSC/DSC-${(contains(vm, 'DSConfig') ? vm.DSConfig : (contains(DSCConfigLookup, DeploymentName) ? DSCConfigLookup[DeploymentName] : DeploymentName))}.zip'
script: 'DSC-${(contains(vm, 'DSConfig') ? vm.DSConfig : (contains(DSCConfigLookup, DeploymentName) ? DSCConfigLookup[DeploymentName] : DeploymentName))}.ps1'
function: (contains(vm, 'DSConfig') ? vm.DSConfig : (contains(DSCConfigLookup, DeploymentName) ? DSCConfigLookup[DeploymentName] : DeploymentName))
}
configurationArguments: {
DomainName: Global.ADDomainName
Thumbprint: Global.certificateThumbprint
storageAccountId: saaccountidglobalsource.id
deployment: Deployment
networkid: '${networkId}.'
appInfo: (contains(vm, 'AppInfo') ? string(vm.AppInfo) : '')
DataDiskInfo: string(VM[index].DataDisk)
clientIDLocal: '${Environment}${DeploymentID}' == 'G0' ? '' : UAILocal.properties.clientId
clientIDGlobal: '${Environment}${DeploymentID}' == 'G0' ? '' : UAIGlobal.properties.clientId
}
configurationData: {
url: '${Global._artifactsLocation}/ext-CD/${vm.Role}-ConfigurationData.psd1'
}
}
protectedSettings: {
configurationArguments: {
AdminCreds: {
UserName: Global.vmAdminUserName
Password: vmAdminPassword
}
sshPublic: {
UserName: 'ssh'
Password: sshPublic
}
devOpsPat: {
UserName: 'pat'
Password: devOpsPat
}
}
configurationUrlSasToken: Global._artifactsLocationSasToken
configurationDataUrlSasToken: Global._artifactsLocationSasToken
}
}
dependsOn: [
VMDomainJoin[index]
]
}] |
Beta Was this translation helpful? Give feedback.
-
|
The culprit was in the Bicep template
ModuleUrl: uri('https://dev.azure.com/jobothw/_git/Templates', '?path=/DSC/CreateADPDC.zip')
It should be ModelsUrl.
Changed the template to ModulesUrl: (uri('https://dev.azure.com/jobothw/_git/Templates?path=/DSC/CreateADPDC.zip', ''))
And am getting this error now:
ModulesUrl: (uri('https://dev.azure.com/jobothw/_git/Templates?path=/DSC/CreateADPDC.zip', ''))
Contents of C:\packages\pluguins\Microsoft.\Powershell.DSC\2.83.2.0\RuntimeSettings\0.settings
"runtimeSettings": [
{
"handlerSettings": {
"protectedSettingsCertThumbprint": "A688867F77B0D00240695EA55AA89FD39ADDFA0D",
"protectedSettings": "MIIB2AYJKoZIhvcNAQcDoIIByTCCAcUCAQAxggFpMIIBZQIBADBNMDkxNzA1BgoJkiaJk/IsZAEZFidXaW5kb3dzIEF6dXJlIENSUCBDZXJ0aWZpY2F0ZSBHZW5lcmF0b3ICEBkZM9EzfMq3QXJ83Ov3wVcwDQYJKoZIhvcNAQEBBQAEggEARTX3rnA9rWn4lDwZiGb6NOrHD3nxz0dlqlIGQHyZcJXDrkQ3+Cm4rwccE1bjAXht0dW4x5W9bSvqoB1UMBl3uoFPv4HWE4ErhN0c95m5Oj0oyoYXH0auVsjj39CCjoKTMW49w8Sa81UvwCIqELymzy4Mb/p6YoxYPO7+D1Y5FAi+Ys1f4W7UQ3DqEmQ4t1/gtYUug2w9Q5kHjzIWF2E4XDop+F4CTi3+Z0LES85pLluFBKMkY6k3riaNMvDJIhBtRQq8TpjsBdMkAVy8jBkCYQPfI6PCaYVbWH02fQdt7rfV+b3X+0QjG+dnVsINCBLF8iaWZ7BliNyhy0VCnW8m/zBTBgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECDAzQauCSEQ6gDAJB3Rzo4gwmzUFUzxciHNhitGGrtGRFGpsLePw6goyxrc+oy5qpO7Rg3x27jY1eKA=",
"publicSettings": {"ModulesUrl":https://dev.azure.com/jobothw/_git/Templates?path=/DSC/CreateADPDC.zip,"ConfigurationFunction":"CreateADPDC.ps1\\CreateADPDC","Properties":{"DomainName":"Contoso.com","Admincreds":{"UserName":"xAdministrator","Password":"PrivateSettingsRef:AdminPassword"}}}
}
}
]
}
Obviously I don't undestand how to construce the uri and don't understand why it is loging at Temples instead of tempates?path=/DSC/CreateADPDC.zip
Joe Bothwell | Customer Engineer | Microsoft Federal
Mobile: +1 (703) 217-2492|Email: ***@***.***
[X]
From: Ben Wilkinson ***@***.***>
Sent: Friday, October 8, 2021 2:36 PM
To: Azure/bicep ***@***.***>
Cc: Joe Bothwell (PFE) ***@***.***>; Author ***@***.***>
Subject: Re: [Azure/bicep] Error when invoking DSC module (Discussion #4765)
note this is what you have
resource vmName_vmExtensionName ***@***.***' = {
dependsOn: [
virtualMachines_MIM_DC_01_name_resource
]
parent: virtualMachines_MIM_DC_01_name_resource
name: 'CreateADForest'
location: location
properties: {
publisher: 'Microsoft.Powershell'
type: 'DSC'
typeHandlerVersion: '2.19'
autoUpgradeMinorVersion: true
settings: {
//ModulesUrl: uri('${artifactsLocation}/DSC/CreateADPC.zip', '${moduleFilePath}${artifactsLocationSasToken}')
//ModulesUrl: uri('${artifactsLocation}/${moduleFilePath}', '${moduleFilePath}${artifactsLocationSasToken}')
//ModuleUrl: uri('https://dev.azure.com/jobothw/_git/Templates?path=/DSC/CreateADPDC.zip', '${moduleFilePath}${artifactsLocationSasToken}')
ModuleUrl: uri('https://dev.azure.com/jobothw/_git/Templates', '?path=/DSC/CreateADPDC.zip')
ConfigurationFunction: configurationFunction
Properties: {
DomainName: domainName
Admincreds: {
UserName: adminUsername
Password: 'PrivateSettingsRef:AdminPassword'
}
MachineName: vmName
}
}
protectedSettings: {
Items: {
adminPassword: adminPassword
}
}
}
}
This was my reference
resource VMDSC ***@***.***' = [for (vm, index) in AppServers: if (VM[index].match && VM[index].Extensions.DSC == 1 && vm.Role != 'PULL' && ! (DeploymentName == 'ConfigSQLAO' || DeploymentName == 'CreateADPDC' || DeploymentName == 'CreateADBDC')) {
name: 'Microsoft.Powershell.DSC'
parent: virtualMachine[index]
location: resourceGroup().location
properties: {
publisher: ((OSType[vm.OSType].OS == 'Windows') ? 'Microsoft.Powershell' : 'Microsoft.OSTCExtensions')
type: ((OSType[vm.OSType].OS == 'Windows') ? 'DSC' : 'DSCForLinux')
typeHandlerVersion: ((OSType[vm.OSType].OS == 'Windows') ? '2.24' : '2.0')
autoUpgradeMinorVersion: true
forceUpdateTag: deploymentTime
settings: {
wmfVersion: 'latest'
configuration: {
url: '${Global._artifactsLocation}/ext-DSC/DSC-${(contains(vm, 'DSConfig') ? vm.DSConfig : (contains(DSCConfigLookup, DeploymentName) ? DSCConfigLookup[DeploymentName] : DeploymentName))}.zip'
script: 'DSC-${(contains(vm, 'DSConfig') ? vm.DSConfig : (contains(DSCConfigLookup, DeploymentName) ? DSCConfigLookup[DeploymentName] : DeploymentName))}.ps1'
function: (contains(vm, 'DSConfig') ? vm.DSConfig : (contains(DSCConfigLookup, DeploymentName) ? DSCConfigLookup[DeploymentName] : DeploymentName))
}
configurationArguments: {
DomainName: Global.ADDomainName
Thumbprint: Global.certificateThumbprint
storageAccountId: saaccountidglobalsource.id
deployment: Deployment
networkid: '${networkId}.'
appInfo: (contains(vm, 'AppInfo') ? string(vm.AppInfo) : '')
DataDiskInfo: string(VM[index].DataDisk)
clientIDLocal: '${Environment}${DeploymentID}' == 'G0' ? '' : UAILocal.properties.clientId
clientIDGlobal: '${Environment}${DeploymentID}' == 'G0' ? '' : UAIGlobal.properties.clientId
}
configurationData: {
url: '${Global._artifactsLocation}/ext-CD/${vm.Role}-ConfigurationData.psd1'
}
}
protectedSettings: {
configurationArguments: {
AdminCreds: {
UserName: Global.vmAdminUserName
Password: vmAdminPassword
}
sshPublic: {
UserName: 'ssh'
Password: sshPublic
}
devOpsPat: {
UserName: 'pat'
Password: devOpsPat
}
}
configurationUrlSasToken: Global._artifactsLocationSasToken
configurationDataUrlSasToken: Global._artifactsLocationSasToken
}
}
dependsOn: [
VMDomainJoin[index]
]
}]
-
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fbicep%2Fdiscussions%2F4765%23discussioncomment-1449977&data=04%7C01%7CJoe.Bothwell%40microsoft.com%7Ce37ae3545b0347ff82da08d98a8a713a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637693150272843392%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=mzZJW%2BlULYWzUt%2FbdVkk8%2Ficsr1u7k63ytc86rYIeJ4%3D&reserved=0>, or unsubscribe<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJ2MBFFTHHFSUKN5F2KW76TUF42YDANCNFSM5FRYUMGA&data=04%7C01%7CJoe.Bothwell%40microsoft.com%7Ce37ae3545b0347ff82da08d98a8a713a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637693150272853349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=RlxsbopKVYMWfh9ZdHNkX2kNqZoF67ZrKanBY4%2BTvSo%3D&reserved=0>.
Triage notifications on the go with GitHub Mobile for iOS<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7CJoe.Bothwell%40microsoft.com%7Ce37ae3545b0347ff82da08d98a8a713a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637693150272853349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=a8XHBROgGO9wWsWPxwvRyza%2BhA2XjSpDU12A54%2F5WPw%3D&reserved=0> or Android<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7CJoe.Bothwell%40microsoft.com%7Ce37ae3545b0347ff82da08d98a8a713a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637693150272853349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=VHcF98ySDykfpZ9Qiq03gKn3zp45EgXfE23kGsL79rU%3D&reserved=0>.
|
Beta Was this translation helpful? Give feedback.


note this is what you have