Azure Service Bus subscriptions with rules can prevent deployment
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
Adding two ServiceBusTopic subscriptions that each of them have a rule with the same name produces invalid bicep files that will prevent deployment since both rule resources will be generated with the same name.
Ex.
MySubscription1 -> MyRuleName
MySubscription2 -> MyRuleName
### Expected Behavior
Since this is actually an allowed scenario in Azure Service Bus, the generated bicep should try to generate both resources with different naming so it can deploy without issues.
### Steps To Reproduce
```
var builder = DistributedApplication.CreateBuilder(args);
var serviceBus = builder.AddAzureServiceBus("servicebus");
var myTopic = serviceBus.AddServiceBusTopic("MyTopic");
myTopic.AddServiceBusSubscription("mySubscription1", "mySubscription1").WithProperties(s => s.Rules.Add(new AzureServiceBusRule("ruleName")
{
CorrelationFilter = new AzureServiceBusCorrelationFilter { Subject = "subject1" }
}));
myTopic.AddServiceBusSubscription("mySubscription2", "mySubscription2").WithProperties(s => s.Rules.Add(new AzureServiceBusRule("ruleName")
{
CorrelationFilter = new AzureServiceBusCorrelationFilter { Subject = "subject2" }
}));
```
### Exceptions (if any)
_No response_
### .NET Version info
10.0.0
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.