Skip to content

Commit

Permalink
Fixed some typos. (#765)
Browse files Browse the repository at this point in the history
* Fix Powershell typos.

* Typos.

* Delete custom-words.txt

* Delete fix.txt

* Delete cspell.config.yaml
  • Loading branch information
lzandman authored Oct 9, 2024
1 parent 4b8dd0d commit f80a43a
Show file tree
Hide file tree
Showing 34 changed files with 95 additions and 95 deletions.
2 changes: 1 addition & 1 deletion Docs/operational-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Parameters:

* **OutputFolder**: Output Folder. Defaults to the path 'Output'.

* **AutoCreateParameters**: Automatically create parameters for Azure Policy Sets and Assginment Files.
* **AutoCreateParameters**: Automatically create parameters for Azure Policy Sets and Assignment Files.

* **UseBuiltIn**: Default to using builtin policies rather than local versions.

Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Build-AssignmentDefinitionAtLeaf.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function Build-AssignmentDefinitionAtLeaf {
continue
}
elseif (-not (Confirm-ValidPolicyResourceName -Name $name)) {
Write-Error " Leaf Node $($nodeName): Assignment name '$name' contains invalid charachters <>*%&:?.+/ or ends with a space."
Write-Error " Leaf Node $($nodeName): Assignment name '$name' contains invalid characters <>*%&:?.+/ or ends with a space."
$hasErrors = $true
continue
}
Expand Down
6 changes: 3 additions & 3 deletions Scripts/Helpers/Build-AssignmentPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Build-AssignmentPlan {
Write-Warning "No Policy Assignment files found! Deleting any Policy Assignments."
}

# Cache role assognments and definitions
# Cache role assignments and definitions
$deployedPolicyAssignments = $deployedPolicyResources.policyassignments.managed
$deployedRoleAssignmentsByPrincipalId = $DeployedPolicyResources.roleAssignmentsByPrincipalId
$deleteCandidates = $deployedPolicyAssignments.Clone()
Expand Down Expand Up @@ -330,12 +330,12 @@ function Build-AssignmentPlan {
}
otherPaC {
if ($VerbosePreference -eq "Continue") {
Write-AssignmentDetails -DisplayName $displayName -Scope $shortScope -Prefix "Skipping delete (owened by other PaC):" -IdentityStatus $identityStatus
Write-AssignmentDetails -DisplayName $displayName -Scope $shortScope -Prefix "Skipping delete (owned by other PaC):" -IdentityStatus $identityStatus
}
}
unknownOwner {
if ($VerbosePreference -eq "Continue") {
Write-AssignmentDetails -DisplayName $displayName -Scope $shortScope -Prefix "Skipping delete owmed by unknown (strategy $strategy):" -IdentityStatus $identityStatus
Write-AssignmentDetails -DisplayName $displayName -Scope $shortScope -Prefix "Skipping delete owned by unknown (strategy $strategy):" -IdentityStatus $identityStatus
}
}
managedByDfcSecurityPolicies {
Expand Down
14 changes: 7 additions & 7 deletions Scripts/Helpers/Build-ExemptionsPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function Build-ExemptionsPlan {
$errorInfo.hasLocalErrors = $false
$entryNumber++

#region read row values andd skip empty rows on CSV files
#region read row values and skip empty rows on CSV files
$name = $row.name
$displayName = $row.displayName
$exemptionCategory = $row.exemptionCategory
Expand Down Expand Up @@ -141,11 +141,11 @@ function Build-ExemptionsPlan {
continue
}
}
#endregion read row values andd skip empty rows on CSV files
#endregion read row values and skip empty rows on CSV files

if ($isCsvFile) {

#region CSV files can define the assignment with assignmentReferenceId or the leagcy policyAssignmentId
#region CSV files can define the assignment with assignmentReferenceId or the legacy policyAssignmentId
if ([string]::IsNullOrWhitespace($assignmentReferenceId) -xor [string]::IsNullOrWhitespace($policyAssignmentId)) {
if (-not [string]::IsNullOrWhitespace($assignmentReferenceId)) {
if ($assignmentReferenceId.StartsWith("policyDefinitions/")) {
Expand Down Expand Up @@ -173,7 +173,7 @@ function Build-ExemptionsPlan {
else {
Add-ErrorMessage -ErrorInfo $errorInfo -ErrorString "exactly one of the columns policyAssignmentId or assignmentReferenceId must have a non-empty cell" -EntryNumber $entryNumber
}
#endregion CSV files can define the assignment with assignmentReferenceId or the leagcy policyAssignmentId
#endregion CSV files can define the assignment with assignmentReferenceId or the legacy policyAssignmentId

#region Convert referenceIds into array (if cell empty, set to empty array)
$final = @()
Expand Down Expand Up @@ -202,7 +202,7 @@ function Build-ExemptionsPlan {
}
#endregion table must contain scope or scopes column

#region Convert resourceSelectors into array (if cell empty, set to Snull)
#region Convert resourceSelectors into array (if cell empty, set to $null)
$resourceSelectors = $null
$step1 = $row.resourceSelectors
if (-not [string]::IsNullOrWhiteSpace($step1)) {
Expand All @@ -219,7 +219,7 @@ function Build-ExemptionsPlan {
}
}
}
#endregion Convert resourceSelectors into array (if cell empty, set to Snull)
#endregion Convert resourceSelectors into array (if cell empty, set to $null)

#region convert metadata JSON to object
$step1 = $row.metadata
Expand Down Expand Up @@ -420,7 +420,7 @@ function Build-ExemptionsPlan {
}
else {
if (-not (Confirm-ValidPolicyResourceName -Name $name)) {
Add-ErrorMessage -ErrorInfo $errorInfo -ErrorString "name '$($name.Substring(0, 32))...' contains invalid charachters <>*%&:?.+/ or ends with a space." -EntryNumber $entryNumber
Add-ErrorMessage -ErrorInfo $errorInfo -ErrorString "name '$($name.Substring(0, 32))...' contains invalid characters <>*%&:?.+/ or ends with a space." -EntryNumber $entryNumber
}
elseif ($name.Length -gt 64) {
Add-ErrorMessage -ErrorInfo $errorInfo -ErrorString "name too long (max 64 characters)" -EntryNumber $entryNumber
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Build-PolicyPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function Build-PolicyPlan {
Write-Error "Policy from file '$($file.Name)' requires a name" -ErrorAction Stop
}
if (-not (Confirm-ValidPolicyResourceName -Name $name)) {
Write-Error "Policy from file '$($file.Name) has a name '$name' containing invalid charachters <>*%&:?.+/ or ends with a space." -ErrorAction Stop
Write-Error "Policy from file '$($file.Name) has a name '$name' containing invalid characters <>*%&:?.+/ or ends with a space." -ErrorAction Stop
}
if ($null -eq $displayName) {
Write-Error "Policy '$name' from file '$($file.Name)' requires a displayName" -ErrorAction Stop
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Build-PolicySetPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function Build-PolicySetPlan {
Write-Error "Policy Set from file '$($file.Name)' requires a name" -ErrorAction Stop
}
if (-not (Confirm-ValidPolicyResourceName -Name $name)) {
Write-Error "Policy Set from file '$($file.Name) has a name '$name' containing invalid charachters <>*%&:?.+/ or ends with a space." -ErrorAction Stop
Write-Error "Policy Set from file '$($file.Name) has a name '$name' containing invalid characters <>*%&:?.+/ or ends with a space." -ErrorAction Stop
}
if ($null -eq $displayName) {
Write-Error "Policy Set '$name' from file '$($file.Name)' requires a displayName" -ErrorAction Stop
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Helpers/Build-ScopeTableForManagementGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function Build-ScopeTableForManagementGroup {
}
#endregion recurse down the tree

#region augment this parents scope's details with this mangement group's details
#region augment this parents scope's details with this management group's details
if ($null -ne $ParentScopeDetails) {
$parentScopeChildrenTable = $ParentScopeDetails.childrenTable
$parentScopeResourceGroupsTable = $ParentScopeDetails.resourceGroupsTable
Expand All @@ -144,7 +144,7 @@ function Build-ScopeTableForManagementGroup {
$null = $parentScopeExcludedScopesTable.Add($excludedScope, $excludedScopesTable.$excludedScope)
}
}
#endregion augment this parents scope's details with this mangement group's details
#endregion augment this parents scope's details with this management group's details

return $scopeDetails
}
4 changes: 2 additions & 2 deletions Scripts/Helpers/Build-ScopeTableForSubscription.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function Build-ScopeTableForSubscription {
}
#endregion augment resource groups scope details

#region augemnt this parents scope's details with this subscription's details
#region augment this parents scope's details with this subscription's details
if ($null -ne $ParentScopeDetails) {
$parentScopeChildrenTable = $ParentScopeDetails.childrenTable
$parentScopeResourceGroupsTable = $ParentScopeDetails.resourceGroupsTable
Expand All @@ -131,7 +131,7 @@ function Build-ScopeTableForSubscription {
$null = $parentScopeExcludedScopesTable.Add($excludedScope, $excludedScopesTable.$excludedScope)
}
}
#endregion augemnt this parents scope's details with this subscription's details
#endregion augment this parents scope's details with this subscription's details

return $scopeDetails
}
2 changes: 1 addition & 1 deletion Scripts/Helpers/Confirm-ActiveAzExemptions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function Confirm-ActiveAzExemptions {
all = $allExemptions
active = $activeExemptions
expiresInDays = $expiringExemptions # Subset of active
orphaned = $orphanedExemptions # Orpahned trumps expired
orphaned = $orphanedExemptions # Orphaned trumps expired
expired = $expiredExemptions
}

Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Confirm-ObjectValueEqualityDeep.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Confirm-ObjectValueEqualityDeep {
return $true
}
if ($null -eq $Object1) {
# $Object1 is $null, swap $Object1 and $Object2 to ensure that Object1 (the old Object2) is not $null and Object2 (the old Object1) is $null (setting it to $null is ommited because it is not used in the subsequent code)
# $Object1 is $null, swap $Object1 and $Object2 to ensure that Object1 (the old Object2) is not $null and Object2 (the old Object1) is $null (setting it to $null is omitted because it is not used in the subsequent code)
$Object1 = $Object2
$Object2 = $null
}
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Helpers/Confirm-PacOwner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ function Confirm-PacOwner {
$definitionIdParts = Split-AzPolicyResourceId -Id $properties.policyDefinitionId
if ($definitionIdParts.scopeType -eq "builtin") {
# Check if the owner is a special case, either managed by DfC's "Security Policies" or one of the "Defender Plans"
# This didcult due to inconsistent naming and createdBy users.
# This is difficult due to inconsistent naming and createdBy users.
# At present, the only way to identify these is by string comparing the description field. This is not ideal.
# "Security Policies" (e.g., MCSB, NIST, ...) use a description "This object has been generated by Microsoft Defender for Cloud. To make changes, navigate to the security policies management page.",
# "Defender Plans" (e.g., Servers, App Service, Databases, ...) use a description srtaing with "This policy assignment was automatically created by "
# "Defender Plans" (e.g., Servers, App Service, Databases, ...) use a description starting with "This policy assignment was automatically created by "
if ($description.StartsWith("This object has been generated by ")) {
$ManagedByCounters.dfcSecurityPolicies += 1
return "managedByDfcSecurityPolicies"
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Confirm-ParametersDefinitionMatch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Confirm-ParametersDefinitionMatch {
}
}
foreach ($existingParameterName in $existingParameters.Keys) {
# ignore paramer name case
# ignore parameter name case
$definedParameterNameArray = $definedParameters.Keys -eq $existingParameterName
if ($definedParameterNameArray.Count -gt 0) {
# found a matching parameter name (case insensitive)
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Confirm-PolicyResourceExclusions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function Confirm-PolicyResourceExclusions {
return $true, $resourceIdParts
}
if (-not $ScopeTable.ContainsKey($scope)) {
Write-Verbose "Unmanged scope '$scope', resource '$($ResourceId)'"
Write-Verbose "Unmanaged scope '$scope', resource '$($ResourceId)'"
if ($null -ne $PolicyResourceTable) {
$PolicyResourceTable.counters.unmanagedScopes += 1
}
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Confirm-ValidPolicyResourceName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Confirm-ValidPolicyResourceName {
$Name
)

# Test is the Name has any charcters from thisn string of characters "<>*%&:?.+/" in it or ends with a space
# Test is the Name has any characters from this string of characters "<>*%&:?.+/" in it or ends with a space
if ($Name -match "[\<\>\*\%\&\:\?\+\/\\]" -or $Name.EndsWith(" ")) {
return $false
}
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Convert-AllowedEffectsToCsvString.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Convert-AllowedEffectsToCsvString {

$effectArray = @()
foreach ($effectValue in @( "Modify", "Append", "DenyAction", "Deny", "Audit", "Manual", "DeployIfNotExists", "AuditIfNotExists", "Disabled" )) {
# sorted logicaly
# sorted logically
if ($allowedList -contains $effectValue) {
$effectArray += $effectValue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function Convert-PolicyResourcesDetailsToFlatList {
}
else {
$null = $parametersAlreadyCovered.Add($parameterName, $true)
$parameter.multiUse = $false # Redo multi-use based on sorted liist of Policies
$parameter.multiUse = $false # Redo multi-use based on sorted list of Policies

$parameterValue = $null
if ($null -ne $assignmentId) {
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Find-AzNonCompliantResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Find-AzNonCompliantResources {
)

Write-Information "==================================================================================================="
Write-Information "Retrieve Policy Commpliance List"
Write-Information "Retrieve Policy Compliance List"
Write-Information "==================================================================================================="
$effectFilter = ""
if ($PolicyEffectFilter -and $ExcludeManualPolicyEffect) {
Expand Down
20 changes: 10 additions & 10 deletions Scripts/Helpers/Get-CalculatedPolicyAssignmentsAndReferenceIds.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function Get-CalculatedPolicyAssignmentsAndReferenceIds {
$index = 0
foreach ($assignment in $Assignments) {
$assignmentId = $assignment.id
$assignmentPoperties = Get-PolicyResourceProperties $assignment
$assignedPolicyDefinitionId = $assignmentPoperties.policyDefinitionId
$assignmentProperties = Get-PolicyResourceProperties $assignment
$assignedPolicyDefinitionId = $assignmentProperties.policyDefinitionId

if ($assignedPolicyDefinitionId.Contains("/providers/Microsoft.Authorization/policyDefinitions/", [StringComparison]::InvariantCultureIgnoreCase)) {

Expand All @@ -29,10 +29,10 @@ function Get-CalculatedPolicyAssignmentsAndReferenceIds {
id = $assignmentId
scope = $assignment.scope
name = $assignment.name
displayName = $assignmentPoperties.displayName
displayName = $assignmentProperties.displayName
assignedPolicyDefinitionId = $assignedPolicyDefinitionId
policyDefinitionId = $assignedPolicyDefinitionId
notScopes = $assignmentPoperties.notScopes
notScopes = $assignmentProperties.notScopes
isPolicyAssignment = $true
allowReferenceIdsInRow = $false
policyDefinitionReferenceIds = $null
Expand All @@ -58,7 +58,7 @@ function Get-CalculatedPolicyAssignmentsAndReferenceIds {
elseif ($assignedPolicyDefinitionId.Contains("/providers/Microsoft.Authorization/policySetDefinitions/", [StringComparison]::InvariantCultureIgnoreCase)) {
$thisPolicySetReferences = $null

#region caclculate referenceId values for this Policy Set
#region calculate referenceId values for this Policy Set
if ($byPolicySetIdPolicyDefinitionReferences.ContainsKey($assignedPolicyDefinitionId)) {
# use previously calculated values
$thisPolicySetReferences = $byPolicySetIdPolicyDefinitionReferences.$assignedPolicyDefinitionId
Expand Down Expand Up @@ -101,17 +101,17 @@ function Get-CalculatedPolicyAssignmentsAndReferenceIds {
$policyIndex++
}
}
#endregion caclculate referenceId values for this Policy Set
#endregion calculate referenceId values for this Policy Set

#region calculated assignment for this policyAssignment AND for this policySetId
$calculatedPolicyAssignment = @{
id = $assignmentId
scope = $assignment.scope
name = $assignment.name
displayName = $assignmentPoperties.displayName
displayName = $assignmentProperties.displayName
assignedPolicyDefinitionId = $assignedPolicyDefinitionId
policyDefinitionId = $null
notScopes = $assignmentPoperties.notScopes
notScopes = $assignmentProperties.notScopes
isPolicyAssignment = $false
allowReferenceIdsInRow = $true
policyDefinitionReferenceIds = $thisPolicySetReferences.policyDefinitionReferenceIds
Expand Down Expand Up @@ -141,10 +141,10 @@ function Get-CalculatedPolicyAssignmentsAndReferenceIds {
id = $assignmentId
scope = $assignment.scope
name = $assignment.name
displayName = $assignmentPoperties.displayName
displayName = $assignmentProperties.displayName
assignedPolicyDefinitionId = $assignedPolicyDefinitionId
policyDefinitionId = $policyDefinitionId
notScopes = $assignmentPoperties.notScopes
notScopes = $assignmentProperties.notScopes
isPolicyAssignment = $false
allowReferenceIdsInRow = $false
policyDefinitionReferenceIds = $thisPolicyReferences.referenceIds
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Get-HydrrationChildManagementGroupNameList {
function Get-HydrationChildManagementGroupNameList {
<#
.SYNOPSIS
This function retrieves a list of all child management groups of a given management group.
Expand Down
Loading

0 comments on commit f80a43a

Please sign in to comment.