Skip to content

Add Azure.ServiceBus.ReplicaLocation rule (AZR-000540)#3718

Open
Copilot wants to merge 5 commits intomainfrom
copilot/add-service-bus-replica-location-check
Open

Add Azure.ServiceBus.ReplicaLocation rule (AZR-000540)#3718
Copilot wants to merge 5 commits intomainfrom
copilot/add-service-bus-replica-location-check

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

When Service Bus geo-replication is configured, replica locations should be validated against the organization's allowed regions (AZURE_RESOURCE_ALLOWED_LOCATIONS), consistent with how Azure.EntraDS.ReplicaLocation works for Entra DS replica sets.

Changes

  • New rule Azure.ServiceBus.ReplicaLocation (AZR-000536, Security pillar, ruleSet 2026_06) — evaluates each locationName in properties.geoDataReplication.locations[*] against the allowed locations context; skips namespaces without geo-replication configured
  • Tests — new With Location Configuration context in Azure.ServiceBus.Tests.ps1 using AZURE_RESOURCE_ALLOWED_LOCATIONS = ['centraluseuap', 'norwayeast']; servicens-E (italynorth/spaincentral) fails, servicens-C/servicens-D pass
  • DocsAzure.ServiceBus.ReplicaLocation.md with Bicep and ARM examples; updated index.md, resource.md (en + es)

Example

resource sb 'Microsoft.ServiceBus/namespaces@2023-01-01-preview' = {
  properties: {
    geoDataReplication: {
      locations: [
        { locationName: primaryLocation, roleType: 'Primary' }
        { locationName: secondaryLocation, roleType: 'Secondary' }
      ]
    }
  }
}

Passes when both primaryLocation and secondaryLocation are in AZURE_RESOURCE_ALLOWED_LOCATIONS; fails otherwise.

Original prompt

This section details on the original issue you should resolve

<issue_title>[RULE] Check service bus replica locations are within allowed regions</issue_title>
<issue_description>### Existing rule

No response

Suggested rule

When service bus replication is configured any configured locations should be in the allowed location list if configured.

Pillar

Security

Additional context

This is similar to the existing rule Azure.EntraDS.ReplicaLocation.

References:

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…eplication replica locations are within allowed regions

Co-authored-by: BernieWhite <13513058+BernieWhite@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/PSRule.Rules.Azure/sessions/31679168-91da-40a5-9474-6c4b54ac8252
Copilot AI changed the title [WIP] Add rule to check service bus replica locations are within allowed regions Add Azure.ServiceBus.ReplicaLocation rule (AZR-000535) Mar 25, 2026
Copilot AI requested a review from BernieWhite March 25, 2026 08:02
@BernieWhite
Copy link
Copy Markdown
Collaborator

@copilot use rule ID AZR-000536 instead.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 25, 2026

@copilot use rule ID AZR-000536 instead.

Updated to AZR-000536 in 190fb5c.

Copilot AI changed the title Add Azure.ServiceBus.ReplicaLocation rule (AZR-000535) Add Azure.ServiceBus.ReplicaLocation rule (AZR-000536) Mar 25, 2026
@BernieWhite BernieWhite changed the title Add Azure.ServiceBus.ReplicaLocation rule (AZR-000536) Add Azure.ServiceBus.ReplicaLocation rule (AZR-000540) Mar 26, 2026
@BernieWhite BernieWhite marked this pull request as ready for review March 26, 2026 16:04
@BernieWhite BernieWhite requested a review from a team as a code owner March 26, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RULE] Check service bus replica locations are within allowed regions

2 participants