DSC复合资源参数未显示在Azure状态DSC上

时间:2019-02-22 23:24:50

标签: azure dsc

我正在为复合资源做一个示例,我已经创建了文件夹结构和清单,并且能够将其导入并在自动化帐户中看到它,但是由于某种原因,当我在schema.psm1,我看不到自动化帐户复合资源模块中可用的参数。我在做什么错了?

Mandatory_Params_not_passed

Configuration FeatureInstall {       

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  
}
}

1 个答案:

答案 0 :(得分:0)

我回答自己的问题是我做错了,这是对我有用的方法。

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
}       
}