首页 > 解决方案 > DSC 复合资源参数未显示在 Azure State 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  
}
}

标签: azuredsc

解决方案


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

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

推荐阅读