microsoft / microsoft/aspire

Azure Service Bus subscriptions with rules can prevent deployment

Open
#13,286 0 comments 0 reactions 0 assignees View on GitHub
area-integrations
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.