Aller au contenu
DocumentationEssayer Aspire
DocumentationEssayer

Compiler Warning ASPIRERADIUS003

Ce contenu n’est pas encore disponible dans votre langue.

Version introduced: 13.5

Radius cloud provider types and members are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.

This diagnostic warning is reported when using the experimental Radius cloud-provider APIs from the Aspire.Hosting.Radius integration, WithAzureProvider and WithAwsProvider.

The [Experimental] gate is on WithAzureProvider and WithAwsProvider themselves. The credential callbacks you configure through them—such as WithServicePrincipal, WithWorkloadIdentity, WithAccessKey, and WithIrsa—are part of the same experimental surface; they don’t each emit ASPIRERADIUS003 on their own.

These APIs configure the Azure and AWS cloud providers that the Radius publisher emits and that the deploy pipeline registers credentials for.

The following code generates ASPIRERADIUS003:

AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var clientSecret = builder.AddParameter("azure-sp-secret", secret: true);
builder.AddRadiusEnvironment("radius")
.WithAzureProvider(
subscriptionId: "00000000-0000-0000-0000-000000000000",
resourceGroup: "rg-radius",
azure => azure.WithServicePrincipal(
tenantId: "11111111-1111-1111-1111-111111111111",
clientId: "22222222-2222-2222-2222-222222222222",
clientSecret: clientSecret));
builder.Build().Run();

Suppress the warning with one of the following methods:

  • Set the severity of the rule in the .editorconfig file.

    .editorconfig
    [*.{cs,vb}]
    dotnet_diagnostic.ASPIRERADIUS003.severity = none

    For more information about editor config files, see Configuration files for code analysis rules.

  • Add the following PropertyGroup to your project file:

    C# project file
    <PropertyGroup>
    <NoWarn>$(NoWarn);ASPIRERADIUS003</NoWarn>
    </PropertyGroup>
  • Suppress in code with the #pragma warning disable ASPIRERADIUS003 directive:

    Suppressing the warning
    var clientSecret = builder.AddParameter("azure-sp-secret", secret: true);
    #pragma warning disable ASPIRERADIUS003
    builder.AddRadiusEnvironment("radius")
    .WithAzureProvider(
    subscriptionId: "00000000-0000-0000-0000-000000000000",
    resourceGroup: "rg-radius",
    azure => azure.WithServicePrincipal(
    tenantId: "11111111-1111-1111-1111-111111111111",
    clientId: "22222222-2222-2222-2222-222222222222",
    clientSecret: clientSecret));
    #pragma warning restore ASPIRERADIUS003