Azure / enterprise-azure-policy-as-code

Enterprise-ready Azure Policy-as-Code (PaC) solution (includes Az DevOps pipeline)
https://azure.github.io/enterprise-azure-policy-as-code/
MIT License
415 stars 219 forks source link

EnterprisePolicyAsCode module - Don't use unapproved verbs #584

Closed o-l-a-v closed 4 months ago

o-l-a-v commented 4 months ago

Is your feature request related to a problem? Please describe.

Importing EnterprisePolicyAsCode v10.1.2 generates a warning:

WARNING: The names of some imported commands from the module 'EnterprisePolicyAsCode' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.

Setting verbose and debug to Continue tells us what cmdlets is affected by this:

Click to view detailed output ```pwsh PS C:\Users\olavb> $VerbosePreference = $DebugPreference = 'Continue' PS C:\Users\olavb> Import-Module -Name 'EnterprisePolicyAsCode' VERBOSE: Loading module from path 'C:\Users\olavb\AppData\Local\Microsoft\PowerShell\Modules\EnterprisePolicyAsCode\10.1.2\EnterprisePolicyAsCode.psd1'. VERBOSE: Populating RepositorySourceLocation property for module EnterprisePolicyAsCode. VERBOSE: Loading module from path 'C:\Users\olavb\AppData\Local\Microsoft\PowerShell\Modules\EnterprisePolicyAsCode\10.1.2\EnterprisePolicyAsCode.psm1'. VERBOSE: Exporting function 'Build-DeploymentPlans'. VERBOSE: Exporting function 'Build-PolicyDocumentation'. VERBOSE: Exporting function 'Convert-MarkdownGitHubAlerts'. VERBOSE: Exporting function 'Create-AzRemediationTasks'. VERBOSE: Exporting function 'Create-AzureDevOpsBug'. VERBOSE: Exporting function 'Create-GitHubIssue'. VERBOSE: Exporting function 'Deploy-PolicyPlan'. VERBOSE: Exporting function 'Deploy-RolesPlan'. VERBOSE: Exporting function 'Export-AzPolicyResources'. VERBOSE: Exporting function 'Export-NonComplianceReports'. VERBOSE: Exporting function 'Get-AzExemptions'. VERBOSE: Exporting function 'Get-AzPolicyAliasOutputCSV'. VERBOSE: Exporting function 'New-AzPolicyReaderRole'. VERBOSE: Exporting function 'New-EPACDefinitionFolder'. VERBOSE: Exporting function 'New-EPACGlobalSettings'. VERBOSE: Exporting function 'New-EPACPolicyAssignmentDefinition'. VERBOSE: Exporting function 'New-EPACPolicyDefinition'. VERBOSE: Exporting function 'New-PipelinesFromStarterKit'. VERBOSE: Exporting function 'Remove-AzPolicyExemptionEpac'. VERBOSE: Exporting function 'Set-AzPolicyExemptionEpac'. VERBOSE: Exporting function 'Sync-ALZPolicies'. VERBOSE: Importing function 'Build-DeploymentPlans'. VERBOSE: Importing function 'Build-PolicyDocumentation'. VERBOSE: Importing function 'Convert-MarkdownGitHubAlerts'. WARNING: The names of some imported commands from the module 'EnterprisePolicyAsCode' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb. VERBOSE: The 'Create-AzRemediationTasks' command in the EnterprisePolicyAsCode' module was imported, but because its name does not include an approved verb, it might be difficult to find. The suggested alternative verbs are "New". VERBOSE: Importing function 'Create-AzRemediationTasks'. VERBOSE: The 'Create-AzureDevOpsBug' command in the EnterprisePolicyAsCode' module was imported, but because its name does not include an approved verb, it might be difficult to find. The suggested alternative verbs are "New". VERBOSE: Importing function 'Create-AzureDevOpsBug'. VERBOSE: The 'Create-GitHubIssue' command in the EnterprisePolicyAsCode' module was imported, but because its name does not include an approved verb, it might be difficult to find. The suggested alternative verbs are "New". VERBOSE: Importing function 'Create-GitHubIssue'. VERBOSE: Importing function 'Deploy-PolicyPlan'. VERBOSE: Importing function 'Deploy-RolesPlan'. VERBOSE: Importing function 'Export-AzPolicyResources'. VERBOSE: Importing function 'Export-NonComplianceReports'. VERBOSE: Importing function 'Get-AzExemptions'. VERBOSE: Importing function 'Get-AzPolicyAliasOutputCSV'. VERBOSE: Importing function 'New-AzPolicyReaderRole'. VERBOSE: Importing function 'New-EPACDefinitionFolder'. VERBOSE: Importing function 'New-EPACGlobalSettings'. VERBOSE: Importing function 'New-EPACPolicyAssignmentDefinition'. VERBOSE: Importing function 'New-EPACPolicyDefinition'. VERBOSE: Importing function 'New-PipelinesFromStarterKit'. VERBOSE: Importing function 'Remove-AzPolicyExemptionEpac'. VERBOSE: Importing function 'Set-AzPolicyExemptionEpac'. VERBOSE: Importing function 'Sync-ALZPolicies'. PS C:\Users\olavb> ```

Use New instead?

Describe the solution you'd like

Follow PowerShell guidelines, use approved verbs.

Describe alternatives you've considered

Surpress the warning stream like so:

Import-Module -Name 'EnterprisePolicyAsCode' 3>$null

Additional context

anwather commented 4 months ago

These are just guidelines - however will raise with the team.

o-l-a-v commented 4 months ago

It also produces noise when importing the module.

One could probably still have "Create-*" as alias?

anwather commented 4 months ago

Yes - someone has picked it up and will fix for a future release.

anwather commented 4 months ago

@apybar - as discussed are you ok to update these commands?

apybar commented 4 months ago

@anwather - I'll update these commands

apybar commented 4 months ago

This has been resolved in v10.1.5 Documentation has also been updated here: https://azure.github.io/enterprise-azure-policy-as-code/operational-scripts/