Skip to content

Service bus integration customize sku sample documentation incorrect #3158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
gabynevada opened this issue Apr 24, 2025 · 1 comment · May be fixed by #3157
Open
1 task done

Service bus integration customize sku sample documentation incorrect #3158

gabynevada opened this issue Apr 24, 2025 · 1 comment · May be fixed by #3157
Assignees
Labels
📌 seQUESTered Identifies that an issue has been imported into Quest.

Comments

@gabynevada
Copy link

gabynevada commented Apr 24, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When trying to deploy an Azure Service Bus resource while specifying a specific SKU the publisher generate bicep with errors.

Specifically it generates the following bicep which is missing the name parameter in the sku object. It also hardcodes the sku tier, don't know if it's intended behavior vs using the param already established in the default bicep template.

@description('The location for the resource(s) to be deployed.')
param location string = resourceGroup().location

param sku string = 'Standard'

resource bioapps_bus 'Microsoft.ServiceBus/namespaces@2024-01-01' = {
  name: take('servicebus-${uniqueString(resourceGroup().id)}', 50)
  location: location
  properties: {
    disableLocalAuth: true
  }
  sku: {
    tier: 'Premium'
  }
  tags: {
    'aspire-resource-name': 'service-bus'
  }
}

output serviceBusEndpoint string = service_bus.properties.serviceBusEndpoint

output name string = service_bus.name

The default bicep is as follows

@description('The location for the resource(s) to be deployed.')
param location string = resourceGroup().location

param sku string = 'Standard'

resource bioapps_bus 'Microsoft.ServiceBus/namespaces@2024-01-01' = {
  name: take('servicebus-${uniqueString(resourceGroup().id)}', 50)
  location: location
  properties: {
    disableLocalAuth: true
  }
  sku: {
    name: sku
  }
  tags: {
    'aspire-resource-name': 'service-bus'
  }
}

output serviceBusEndpoint string = service_bus.properties.serviceBusEndpoint

output name string = service_bus.name

Expected Behavior

Te generate valid bicep for deploying an Azure Service Bus resource while specifying an SKU.

Steps To Reproduce

Add the following to AppHost

builder
    .AddAzureServiceBus("service-bus")
    .ConfigureInfrastructure(infra =>
    {
      var serviceBusNamespace = infra
        .GetProvisionableResources()
        .OfType<ServiceBusNamespace>()
        .Single();

      serviceBusNamespace.Sku = new ServiceBusSku { Tier = ServiceBusSkuTier.Premium };
    });

Run azd to generate bicep files

azd config set alpha.infraSynth on
azd infra synth

Exceptions (if any)

No response

.NET Version info

.NET SDK:
 Version:           9.0.201
 Commit:            071aaccdc2
 Workload version:  9.0.200-manifests.a3a1a094
 MSBuild version:   17.13.13+1c2026462

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  15.3
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/9.0.201/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.3
  Architecture: arm64
  Commit:       831d23e561

Anything else?

No response


Associated WorkItem - 424820

@gabynevada
Copy link
Author

After looking into it I noticed that the code sample in the documentation is wrong for specifying another Sku. https://learn.microsoft.com/en-us/dotnet/aspire/messaging/azure-service-bus-integration?tabs=dotnet-cli#customize-provisioning-infrastructure

The correct code snippet should be:

builder.AddAzureServiceBus("service-bus")
    .ConfigureInfrastructure(infra =>
    {
        var serviceBusNamespace = infra.GetProvisionableResources()
                                       .OfType<ServiceBusNamespace>()
                                       .Single();

        serviceBusNamespace.Sku = new ServiceBusSku { Name = ServiceBusSkuName.Premium };
        serviceBusNamespace.Tags.Add("ExampleKey", "Example value");
    });

@gabynevada gabynevada changed the title Aspire.Hosting.Azure 9.2.1 Service bus generates incorrect bicep when specifying sku Service bus integration customize sku sample documentation incorrect Apr 24, 2025
@davidfowl davidfowl reopened this Apr 25, 2025
@davidfowl davidfowl transferred this issue from dotnet/aspire Apr 25, 2025
@IEvangelist IEvangelist self-assigned this Apr 25, 2025
@IEvangelist IEvangelist added the 🗺️ reQUEST Triggers an issue to be imported into Quest. label Apr 25, 2025
@dotnetrepoman dotnetrepoman bot added the 🗺️ mapQUEST Only used as a way to mark an issue as updated. RepoMan should instantly remove it. label Apr 25, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 🗺️ mapQUEST Only used as a way to mark an issue as updated. RepoMan should instantly remove it. label Apr 25, 2025
@sequestor sequestor bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📌 seQUESTered Identifies that an issue has been imported into Quest.
Projects
Status: 🔖 Ready
Development

Successfully merging a pull request may close this issue.

3 participants