ed83
February 25, 2019, 7:15am
1
Hi Everyone,
I’m trying to create some examples with composite resources on Azure, I already created the folder structure and I’m able to see that the modules and they are being imported correctly I can see it in activities, but for some reason. I’m unable to declare values on the parameters that I declaed on my schema.ps1 file.
Configuration FeatureInstallSample
{
Import-DscResource -ModuleName PSDscResources
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$EnsureFeature,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$NameFeature,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$IncludeAllSubFeatures
)
WindowsFeature Features
{
Ensure = $EnsureFeature
Name = $NameFeature
IncludeAllSubFeature = $IncludeAllSubFeatures
}
}
Probably I’m doing something I don’t get what it could be.
It seems your DSC configuration file incorrect.
[pre]
Configuration FeatureInstallSample
{
param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$EnsureFeature,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$NameFeature,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$IncludeAllSubFeatures
)
Import-DscResource-ModuleName PSDesiredStateConfiguration
Node localhost {
WindowsFeature Features {
Ensure = $EnsureFeature
Name = $NameFeature
IncludeAllSubFeature = $IncludeAllSubFeatures
}
}
}
[/pre]
ed83
February 27, 2019, 8:55pm
3
Hi Everyone,
I figured out what was doing wrong. I did it this way and it worked.
Configuration FeatureInstall
{
param
(
[Parameter(Mandatory)]
[string]
$Feature,
[Parameter(Mandatory)]
[string]
$EnsureFeature,
[Parameter(Mandatory)]
[string]
$NameFeature,
[Parameter(Mandatory)]
[string]
$IncludeAllSubFeatures
)
WindowsFeatureSet $Feature
{
Ensure = $EnsureFeature
Name = $NameFeature
IncludeAllSubFeature = $IncludeAllSubFeatures
}
}
Thanks.