Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4c69e67
Initial plan
Copilot Oct 6, 2025
6ad5ab4
Add new naming format rules for containers, databases and infrastruct…
Copilot Oct 6, 2025
cd9c82e
Update documentation for new naming format rules
Copilot Oct 6, 2025
2897561
Add test cases for new naming format rules
Copilot Oct 6, 2025
df5fbbd
Update Service Fabric rules with proper annotations
Copilot Oct 6, 2025
fd7291f
Refactor naming rules and tests based on review feedback
Copilot Oct 10, 2025
8497b42
Add rule documentation for all 27 new naming rules
Copilot Oct 10, 2025
92e95fe
Add Azure.WAF/maturity label (L2) and maturity model link to all nami…
Copilot Oct 11, 2025
f037ec2
Updates
BernieWhite Oct 25, 2025
020177d
Updates
BernieWhite Oct 26, 2025
d36ac8b
Merge branch 'main' into copilot/fix-cde04a13-3f4f-4391-bdb3-6e9fc77b…
BernieWhite Oct 26, 2025
0763115
Updates
BernieWhite Oct 26, 2025
cc159f5
Update
BernieWhite Oct 26, 2025
f614551
Updates
BernieWhite Oct 26, 2025
174cbe6
Updates
BernieWhite Oct 26, 2025
4029043
Updates
BernieWhite Oct 26, 2025
4aa521f
Updates
BernieWhite Nov 1, 2025
dbcd0ab
Updates
BernieWhite Nov 1, 2025
b8b7ffa
Updates
BernieWhite Nov 1, 2025
8c20e76
Merge branch 'main' into copilot/fix-cde04a13-3f4f-4391-bdb3-6e9fc77b…
BernieWhite Nov 3, 2025
f57cde4
Updates
BernieWhite Nov 15, 2025
d6fcf5f
Merge branch 'main' into copilot/fix-cde04a13-3f4f-4391-bdb3-6e9fc77b…
BernieWhite Nov 15, 2025
fedfad4
Updates
BernieWhite Nov 15, 2025
4d60336
Merge branch 'main' into copilot/fix-cde04a13-3f4f-4391-bdb3-6e9fc77b…
BernieWhite Nov 15, 2025
62d510b
Fixes
BernieWhite Nov 15, 2025
7ec873f
Updates
BernieWhite Nov 15, 2025
28b77b7
Updates
BernieWhite Nov 15, 2025
98ec545
Updates
BernieWhite Nov 15, 2025
9193bee
Merge branch 'main' into copilot/fix-cde04a13-3f4f-4391-bdb3-6e9fc77b…
BernieWhite Nov 15, 2025
350a5b1
Fix
BernieWhite Nov 23, 2025
29d3605
Fix
BernieWhite Nov 23, 2025
4e9e9da
Fix
BernieWhite Nov 23, 2025
b7e3b23
Merge branch 'main' into copilot/fix-cde04a13-3f4f-4391-bdb3-6e9fc77b…
BernieWhite Nov 24, 2025
7f52778
Updates
BernieWhite Nov 24, 2025
06b8300
Add Bicep and ARM template examples to Cosmos DB naming rules
Copilot Nov 24, 2025
aacbd2f
Merge branch 'main' into copilot/fix-cde04a13-3f4f-4391-bdb3-6e9fc77b…
BernieWhite Nov 27, 2025
3dd30bf
Updates
BernieWhite Nov 27, 2025
022e871
Updates
BernieWhite Nov 27, 2025
166de04
Updates
BernieWhite Nov 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ See [upgrade notes][1] for helpful information when upgrading from previous vers

## Unreleased

- New rules:
- Added naming format rules for AKS, Container Apps, Service Fabric, Cosmos DB, Redis, and SQL resources.
[#3638](https://github.com/Azure/PSRule.Rules.Azure/issues/3638)

## v1.46.0-B0050 (pre-release)

What's changed since v1.45.2:
Expand Down
27 changes: 27 additions & 0 deletions docs/setup/setup-naming-and-tagging.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,48 @@ To configure the rule for a resource type, set the corresponding configuration v

Rule | Resource type | Configuration value
---- | ------------- | -------------------
`Azure.ACR.Naming` | `Microsoft.ContainerRegistry/registries` | `AZURE_CONTAINER_REGISTRY_NAME_FORMAT`
`Azure.Search.Naming` | `Microsoft.Search/searchServices` | `AZURE_AI_SEARCH_NAME_FORMAT`
`Azure.AI.FoundryNaming` | `Microsoft.CognitiveServices/accounts` with `kind` = `AIServices` | `AZURE_AI_SERVICES_NAME_FORMAT`
`Azure.AKS.Naming` | `Microsoft.ContainerService/managedClusters` | `AZURE_AKS_CLUSTER_NAME_FORMAT`
`Azure.AKS.SystemPoolNaming` | `Microsoft.ContainerService/managedClusters/agentPools` with `mode` = `System` | `AZURE_AKS_SYSTEM_POOL_NAME_FORMAT`
`Azure.AKS.UserPoolNaming` | `Microsoft.ContainerService/managedClusters/agentPools` with `mode` = `User` | `AZURE_AKS_USER_POOL_NAME_FORMAT`
`Azure.AppInsights.Naming` | `Microsoft.Insights/components` | `AZURE_APP_INSIGHTS_NAME_FORMAT`
`Azure.CI.Naming` | `Microsoft.ContainerInstance/containerGroups` | `AZURE_CONTAINER_INSTANCE_NAME_FORMAT`
`Azure.ContainerApp.Naming` | `Microsoft.App/containerApps` | `AZURE_CONTAINER_APP_NAME_FORMAT`
`Azure.ContainerApp.EnvironmentNaming` | `Microsoft.App/managedEnvironments` | `AZURE_CONTAINER_APP_ENVIRONMENT_NAME_FORMAT`
`Azure.ContainerApp.JobNaming` | `Microsoft.App/jobs` | `AZURE_CONTAINER_APP_JOB_NAME_FORMAT`
`Azure.Cosmos.CassandraNaming` | `Microsoft.DocumentDb/databaseAccounts` with Cassandra API | `AZURE_COSMOS_CASSANDRA_NAME_FORMAT`
`Azure.Cosmos.DatabaseNaming` | `Microsoft.DocumentDB/databaseAccounts/sqlDatabases` | `AZURE_COSMOS_DATABASE_NAME_FORMAT`
`Azure.Cosmos.GremlinNaming` | `Microsoft.DocumentDb/databaseAccounts` with Gremlin API | `AZURE_COSMOS_GREMLIN_NAME_FORMAT`
`Azure.Cosmos.MongoNaming` | `Microsoft.DocumentDb/databaseAccounts` with MongoDB API | `AZURE_COSMOS_MONGO_NAME_FORMAT`
`Azure.Cosmos.NoSQLNaming` | `Microsoft.DocumentDb/databaseAccounts` with NoSQL API | `AZURE_COSMOS_NOSQL_NAME_FORMAT`
`Azure.Cosmos.PostgreSQLNaming` | `Microsoft.DBforPostgreSQL/serverGroupsv2` | `AZURE_COSMOS_POSTGRESQL_NAME_FORMAT`
`Azure.Cosmos.TableNaming` | `Microsoft.DocumentDb/databaseAccounts` with Table API | `AZURE_COSMOS_TABLE_NAME_FORMAT`
`Azure.EventGrid.DomainNaming` | `Microsoft.EventGrid/domains` | `AZURE_EVENTGRID_DOMAIN_NAME_FORMAT`
`Azure.EventGrid.TopicNaming` | `Microsoft.EventGrid/topics`, `Microsoft.EventGrid/domains/topics` | `AZURE_EVENTGRID_CUSTOM_TOPIC_NAME_FORMAT`
`Azure.EventGrid.SystemTopicNaming` | `Microsoft.EventGrid/systemTopics` | `AZURE_EVENTGRID_SYSTEM_TOPIC_NAME_FORMAT`
`Azure.VNG.ConnectionNaming` | `Microsoft.Network/connections` | `AZURE_GATEWAY_CONNECTION_NAME_FORMAT`
`Azure.LB.Naming` | `Microsoft.Network/loadBalancers` | `AZURE_LOAD_BALANCER_NAME_FORMAT`
`Azure.Log.Naming` | `Microsoft.OperationalInsights/workspaces` | `AZURE_LOG_WORKSPACE_NAME_FORMAT`
`Azure.MySQL.Naming` | `Microsoft.DBforMySQL/servers`, `Microsoft.DBforMySQL/flexibleServers` | `AZURE_MYSQL_SERVER_NAME_FORMAT`
`Azure.NSG.Naming` | `Microsoft.Network/networkSecurityGroups` | `AZURE_NETWORK_SECURITY_GROUP_NAME_FORMAT`
`Azure.PostgreSQL.Naming` | `Microsoft.DBforPostgreSQL/servers`, `Microsoft.DBforPostgreSQL/flexibleServers` | `AZURE_POSTGRESQL_SERVER_NAME_FORMAT`
`Azure.PublicIP.Naming` | `Microsoft.Network/publicIPAddresses` | `AZURE_PUBLIC_IP_ADDRESS_NAME_FORMAT`
`Azure.Redis.Naming` | `Microsoft.Cache/Redis` | `AZURE_REDIS_CACHE_NAME_FORMAT`
`Azure.RedisEnterprise.Naming` | `Microsoft.Cache/RedisEnterprise` | `AZURE_REDIS_ENTERPRISE_NAME_FORMAT`
`Azure.Group.Naming` | `Microsoft.Resources/resourceGroups` | `AZURE_RESOURCE_GROUP_NAME_FORMAT`
`Azure.Group.RequiredTags` | `Microsoft.Resources/resourceGroups` | `AZURE_RESOURCE_GROUP_REQUIRED_TAGS`
`Azure.Resource.RequiredTags` | Applies to all types that support tags except subscription and resource groups. | `AZURE_RESOURCE_REQUIRED_TAGS`
`Azure.Route.Naming` | `Microsoft.Network/routeTables` | `AZURE_ROUTE_TABLE_NAME_FORMAT`
`Azure.ServiceFabric.Naming` | `Microsoft.ServiceFabric/clusters` | `AZURE_SERVICE_FABRIC_CLUSTER_NAME_FORMAT`
`Azure.ServiceFabric.ManagedNaming` | `Microsoft.ServiceFabric/managedClusters` | `AZURE_SERVICE_FABRIC_MANAGED_CLUSTER_NAME_FORMAT`
`Azure.SQL.ServerNaming` | `Microsoft.Sql/servers` | `AZURE_SQL_SERVER_NAME_FORMAT`
`Azure.SQL.DatabaseNaming` | `Microsoft.Sql/servers/databases` | `AZURE_SQL_DATABASE_NAME_FORMAT`
`Azure.SQL.JobAgentNaming` | `Microsoft.Sql/servers/jobAgents` | `AZURE_SQL_JOB_AGENT_NAME_FORMAT`
`Azure.SQL.ElasticPoolNaming` | `Microsoft.Sql/servers/elasticPools` | `AZURE_SQL_ELASTIC_POOL_NAME_FORMAT`
`Azure.SQL.StretchDBNaming` | `Microsoft.Sql/servers/databases` with Data Warehouse service objective | `AZURE_SQL_STRETCH_DB_NAME_FORMAT`
`Azure.SQLMI.Naming` | `Microsoft.Sql/managedInstances` | `AZURE_SQL_MI_NAME_FORMAT`
`Azure.Storage.Naming` | `Microsoft.Storage/storageAccounts` | `AZURE_STORAGE_ACCOUNT_NAME_FORMAT`
`Azure.Subscription.RequiredTags` | `Microsoft.Subscription/aliases` | `AZURE_SUBSCRIPTION_REQUIRED_TAGS`
`Azure.VM.Naming` | `Microsoft.Compute/virtualMachines` | `AZURE_VIRTUAL_MACHINE_NAME_FORMAT`
Expand Down
5 changes: 5 additions & 0 deletions src/PSRule.Rules.Azure/rules/Azure.ACR.Rule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ Rule 'Azure.ACR.ReplicaLocation' -Ref 'AZR-000494' -Type 'Microsoft.ContainerReg
}
}

# Synopsis: Container registries without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.ACR.Naming' -Ref 'AZR-000504' -Type 'Microsoft.ContainerRegistry/registries' -If { $Configuration['AZURE_CONTAINER_REGISTRY_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_CONTAINER_REGISTRY_NAME_FORMAT, $True);
}

#endregion Rules

#region Helper functions
Expand Down
15 changes: 15 additions & 0 deletions src/PSRule.Rules.Azure/rules/Azure.AKS.Rule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,21 @@ Rule 'Azure.AKS.MaintenanceWindow' -Ref 'AZR-000446' -Type 'Microsoft.ContainerS
}
}

# Synopsis: AKS clusters without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.AKS.Naming' -Ref 'AZR-000498' -Type 'Microsoft.ContainerService/managedClusters' -If { $Configuration['AZURE_AKS_CLUSTER_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_AKS_CLUSTER_NAME_FORMAT, $True);
}

# Synopsis: AKS system node pools without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.AKS.SystemPoolNaming' -Ref 'AZR-000499' -Type 'Microsoft.ContainerService/managedClusters/agentPools' -If { $Configuration['AZURE_AKS_SYSTEM_POOL_NAME_FORMAT'] -ne '' -and $TargetObject.properties.mode -eq 'System' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_AKS_SYSTEM_POOL_NAME_FORMAT, $True);
}

# Synopsis: AKS user node pools without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.AKS.UserPoolNaming' -Ref 'AZR-000500' -Type 'Microsoft.ContainerService/managedClusters/agentPools' -If { $Configuration['AZURE_AKS_USER_POOL_NAME_FORMAT'] -ne '' -and $TargetObject.properties.mode -eq 'User' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_AKS_USER_POOL_NAME_FORMAT, $True);
}

#region Helper functions

function global:GetAgentPoolProfiles {
Expand Down
15 changes: 15 additions & 0 deletions src/PSRule.Rules.Azure/rules/Azure.CI.Rule.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

#
# Validation rules for Azure Container Instances
#

#region Rules

# Synopsis: Container instances without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.CI.Naming' -Ref 'AZR-000505' -Type 'Microsoft.ContainerInstance/containerGroups' -If { $Configuration['AZURE_CONTAINER_INSTANCE_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_CONTAINER_INSTANCE_NAME_FORMAT, $True);
}

#endregion Rules
15 changes: 15 additions & 0 deletions src/PSRule.Rules.Azure/rules/Azure.ContainerApp.Rule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ Rule 'Azure.ContainerApp.AvailabilityZone' -Ref 'AZR-000414' -Type 'Microsoft.Ap
$Assert.HasFieldValue($TargetObject, 'properties.vnetConfiguration.infrastructureSubnetId');
}

# Synopsis: Container apps without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.ContainerApp.Naming' -Ref 'AZR-000501' -Type 'Microsoft.App/containerApps' -If { $Configuration['AZURE_CONTAINER_APP_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_CONTAINER_APP_NAME_FORMAT, $True);
}

# Synopsis: Container apps environments without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.ContainerApp.EnvironmentNaming' -Ref 'AZR-000502' -Type 'Microsoft.App/managedEnvironments' -If { $Configuration['AZURE_CONTAINER_APP_ENVIRONMENT_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_CONTAINER_APP_ENVIRONMENT_NAME_FORMAT, $True);
}

# Synopsis: Container apps jobs without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.ContainerApp.JobNaming' -Ref 'AZR-000503' -Type 'Microsoft.App/jobs' -If { $Configuration['AZURE_CONTAINER_APP_JOB_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_CONTAINER_APP_JOB_NAME_FORMAT, $True);
}

#endregion Rules

#region Helper functions
Expand Down
36 changes: 36 additions & 0 deletions src/PSRule.Rules.Azure/rules/Azure.Cosmos.Rule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,42 @@ Rule 'Azure.Cosmos.DefenderCloud' -Ref 'AZR-000382' -Type 'Microsoft.DocumentDb/
Rule 'Azure.Cosmos.DisableLocalAuth' -Ref 'AZR-000420' -Type 'Microsoft.DocumentDb/databaseAccounts' -If { Test-IsNoSQL } -Tag @{ release = 'GA'; ruleSet = '2024_06'; 'Azure.WAF/pillar' = 'Security'; } -Labels @{ 'Azure.MCSB.v1/control' = 'IM-1'; 'Azure.WAF/maturity' = 'L1' } {
$Assert.HasFieldValue($TargetObject, 'properties.DisableLocalAuth', $true)
}

# Synopsis: Azure Cosmos DB for Apache Cassandra accounts without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.Cosmos.CassandraNaming' -Ref 'AZR-000508' -Type 'Microsoft.DocumentDb/databaseAccounts' -If { $Configuration['AZURE_COSMOS_CASSANDRA_NAME_FORMAT'] -ne '' -and $TargetObject.kind -eq 'GlobalDocumentDB' -and $TargetObject.properties.capabilities | Where-Object { $_.name -eq 'EnableCassandra' } } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_COSMOS_CASSANDRA_NAME_FORMAT, $True);
}

# Synopsis: Azure Cosmos DB for MongoDB accounts without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.Cosmos.MongoNaming' -Ref 'AZR-000509' -Type 'Microsoft.DocumentDb/databaseAccounts' -If { $Configuration['AZURE_COSMOS_MONGO_NAME_FORMAT'] -ne '' -and $TargetObject.kind -eq 'MongoDB' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_COSMOS_MONGO_NAME_FORMAT, $True);
}

# Synopsis: Azure Cosmos DB for NoSQL accounts without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.Cosmos.NoSQLNaming' -Ref 'AZR-000510' -Type 'Microsoft.DocumentDb/databaseAccounts' -If { $Configuration['AZURE_COSMOS_NOSQL_NAME_FORMAT'] -ne '' -and Test-IsNoSQL } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_COSMOS_NOSQL_NAME_FORMAT, $True);
}

# Synopsis: Azure Cosmos DB for Table accounts without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.Cosmos.TableNaming' -Ref 'AZR-000511' -Type 'Microsoft.DocumentDb/databaseAccounts' -If { $Configuration['AZURE_COSMOS_TABLE_NAME_FORMAT'] -ne '' -and $TargetObject.kind -eq 'GlobalDocumentDB' -and $TargetObject.properties.capabilities | Where-Object { $_.name -eq 'EnableTable' } } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_COSMOS_TABLE_NAME_FORMAT, $True);
}

# Synopsis: Azure Cosmos DB for Apache Gremlin accounts without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.Cosmos.GremlinNaming' -Ref 'AZR-000512' -Type 'Microsoft.DocumentDb/databaseAccounts' -If { $Configuration['AZURE_COSMOS_GREMLIN_NAME_FORMAT'] -ne '' -and $TargetObject.kind -eq 'GlobalDocumentDB' -and $TargetObject.properties.capabilities | Where-Object { $_.name -eq 'EnableGremlin' } } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_COSMOS_GREMLIN_NAME_FORMAT, $True);
}

# Synopsis: Azure Cosmos DB PostgreSQL clusters without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.Cosmos.PostgreSQLNaming' -Ref 'AZR-000513' -Type 'Microsoft.DBforPostgreSQL/serverGroupsv2' -If { $Configuration['AZURE_COSMOS_POSTGRESQL_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_COSMOS_POSTGRESQL_NAME_FORMAT, $True);
}

# Synopsis: Azure Cosmos DB databases without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.Cosmos.DatabaseNaming' -Ref 'AZR-000514' -Type 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases' -If { $Configuration['AZURE_COSMOS_DATABASE_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_COSMOS_DATABASE_NAME_FORMAT, $True);
}

#endregion Rules

#region Helper functions
Expand Down
9 changes: 9 additions & 0 deletions src/PSRule.Rules.Azure/rules/Azure.MySQL.Rule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,12 @@ function global:MySQLSingleServerAAD {
}

#endregion Helper functions

#region Naming rules

# Synopsis: MySQL databases without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.MySQL.Naming' -Ref 'AZR-000521' -Type 'Microsoft.DBforMySQL/servers', 'Microsoft.DBforMySQL/flexibleServers' -If { $Configuration['AZURE_MYSQL_SERVER_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_MYSQL_SERVER_NAME_FORMAT, $True);
}

#endregion Naming rules
9 changes: 9 additions & 0 deletions src/PSRule.Rules.Azure/rules/Azure.PostgreSQL.Rule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,12 @@ function global:PostgreSQLSingleServerAAD {
}

#endregion Helper functions

#region Naming rules

# Synopsis: PostgreSQL databases without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.PostgreSQL.Naming' -Ref 'AZR-000522' -Type 'Microsoft.DBforPostgreSQL/servers', 'Microsoft.DBforPostgreSQL/flexibleServers' -If { $Configuration['AZURE_POSTGRESQL_SERVER_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_POSTGRESQL_SERVER_NAME_FORMAT, $True);
}

#endregion Naming rules
14 changes: 14 additions & 0 deletions src/PSRule.Rules.Azure/rules/Azure.Redis.Rule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,17 @@ function global:HasPublicNetworkAccess {
}

#endregion Helper functions

#region Naming rules

# Synopsis: Azure Cache for Redis instances without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.Redis.Naming' -Ref 'AZR-000515' -Type 'Microsoft.Cache/Redis' -If { $Configuration['AZURE_REDIS_CACHE_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_REDIS_CACHE_NAME_FORMAT, $True);
}

# Synopsis: Azure Managed Redis instances without a standard naming convention may be difficult to identify and manage.
Rule 'Azure.RedisEnterprise.Naming' -Ref 'AZR-000516' -Type 'Microsoft.Cache/RedisEnterprise' -If { $Configuration['AZURE_REDIS_ENTERPRISE_NAME_FORMAT'] -ne '' } -Tag @{ release = 'GA'; ruleSet = '2025_12'; 'Azure.WAF/pillar' = 'Operational Excellence' } -Labels @{ 'Azure.CAF' = 'naming' } {
$Assert.Match($PSRule, 'TargetName', $Configuration.AZURE_REDIS_ENTERPRISE_NAME_FORMAT, $True);
}

#endregion Naming rules
Loading
Loading