Skip to content

Invoke-Automation Compliance module is designed as a framework for descibing rules in PowerShell and checking the compliance of these rules on specified objects.

License

Notifications You must be signed in to change notification settings

Invoke-Automation/IACompliance

Repository files navigation

URL index
0

Build status

IACompliance

Invoke-Automation Compliance module is designed as a framework for descibing rules in PowerShell and checking the compliance of these rules on specified objects.

Getting started

Install IACompliance from the PowerShell Gallery using Install-Module.

Install-Module -Name IACompliance

Getting a report

To generate a report you first need to describe Rule (IAComplianceRule) objects.

$rule1 = Rule 'Should start with capital letter' -For {
		$Input[0].GetType().Name -like 'String'
	} -Check {
		$Input -cmatch '^[A-Z]'
	}

Once you have one or more rules you can describe a check (IAComplianceCheck) object, wich defines what objects should comply with these rules.

$check1 = Check 'StringCheck' -This {
		@('Test1','test2','Test 3','Test-4')
	} -Against {
		@(
			$rule1,
			Rule 'Should not contain any spaces' -For {
				$Input[0].GetType().Name -like 'String'
			} -Check {
				$Input.IndexOf(' ') -lt 0
			}
		)
	}

When you have described one or more checks you can combine these in a report using the Get-ComplianceReport cmdlet. By default this wil generate your report to the console but you can ask it to give back an IAComplianceReport object by using the -PassThru parameter.

Get-ComplianceReport -Name 'Alphanumeric Compliance Report' -Checks @(
	$check1,
	Check 'Number Check' -This {
		@(2,3,5,12,2.4)
	} -Against {
		@(
			Rule 'Should be an even number' -For {
				$Input[0].GetType().Name -like 'Int32'
			} -Check {
				$Input % 2 -eq 0
			}
		)
	}
) -PassTru

Contributing to IACompliance

Found a bug?

Submit a bug report via Issues

You want to contribute?

Awesome! Take a look at CONTRIBUTING.md

Legal and Licensing

IACompliance is licensed under the MIT license.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

About

Invoke-Automation Compliance module is designed as a framework for descibing rules in PowerShell and checking the compliance of these rules on specified objects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published