PSRule
PSRule copied to clipboard
Trigger recommended action processed by rules
Currently PSRule validates objects passed to it against a set of rules. Matching rules produce result data for reporting based on pass or failure.
PSRule can be further extended to trigger an recommended action when objects don't pass the conditions with the intent of making the object compliant.
For example:
# Description: Use HTTPS only
Rule 'appServiceApp.UseHTTPS' -If { ResourceType 'Microsoft.Web/sites' } {
Hint 'Disable HTTP when not required'
$TargetObject.Properties.httpsOnly -eq $True
Recommend -Action {
# Corrective action
}
}
Invoke-PSRuleAction
Any consideration of using capabilities provided with https://github.com/microsoft/Requirements?
@gengle Not at the time. At the time i wasn't aware of the project. Thanks.
How would you see that working?
@gengle Thanks for the suggestion, I'll have a look at this.
However any thoughts on how you would like it to work would be great.
#322 could be used to set a block downstream to Requirements.