diff --git a/src/frontend/src/content/docs/diagnostics/aspireazure003.mdx b/src/frontend/src/content/docs/diagnostics/aspireazure003.mdx index a8ad2c806..c83d2082a 100644 --- a/src/frontend/src/content/docs/diagnostics/aspireazure003.mdx +++ b/src/frontend/src/content/docs/diagnostics/aspireazure003.mdx @@ -1,6 +1,6 @@ --- title: Compiler Error ASPIREAZURE003 -seoTitle: "ASPIREAZURE003: Azure Virtual Network types and members are" +seoTitle: "ASPIREAZURE003: Azure types are experimental and subject to change" description: Learn what causes the Aspire compiler error ASPIREAZURE003 and how to fix it so your AppHost builds cleanly. Resolve or suppress it to keep your Aspire build. --- @@ -13,11 +13,19 @@ import { Badge } from '@astrojs/starlight/components'; class:list={'mb-1'} /> -> Azure Virtual Network types and members are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed. +> Azure types and members are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed. -The Aspire Azure hosting integration now ships with support for Azure Virtual Networks. If you're using any of the `Aspire.Hosting.Azure.Network` APIs such as `AddAzureVirtualNetwork`, you might see a compiler error/warning indicating that the API is experimental. This behavior is expected, as the API is still in preview and the shape of this API is expected to change in the future. +The `ASPIREAZURE003` diagnostic applies to experimental Azure types in Aspire hosting integrations. If you use one of these APIs, you may see a compiler error or warning indicating that the API is experimental. This behavior is expected, as these APIs are still in preview and subject to change. -## Example +**APIs that trigger `ASPIREAZURE003` include, but aren't limited to:** + +- `Aspire.Hosting.Azure.Network` APIs such as `AddAzureVirtualNetwork` (since 13.2) +- `Aspire.Hosting.Azure` types such as `AzureRoleAssignmentResource`, `DelegatedSubnetAnnotation`, `IAzureDelegatedSubnetResource`, `IAzurePrivateEndpointTarget`, `IAzureNspAssociationTarget`, and `PrivateEndpointTargetAnnotation` (since 13.4) +- `Aspire.Hosting.Azure.Sql` APIs such as `WithAdminDeploymentScriptSubnet`, `WithAdminDeploymentScriptStorage`, `AdminDeploymentScriptSubnetAnnotation`, and `SubnetAddressAllocator` (since 13.4) + +## Examples + +### Azure Virtual Network (since 13.2) The following code generates `ASPIREAZURE003`: @@ -26,6 +34,15 @@ var vnet = builder.AddAzureVirtualNetwork("vnet"); var subnet = vnet.AddSubnet("pe-subnet", "10.0.1.0/24"); ``` +### Azure role assignment resource (since 13.4) + +Using `AzureRoleAssignmentResource` directly also generates `ASPIREAZURE003`: + +```csharp title="C# — AppHost.cs" +// Directly referencing AzureRoleAssignmentResource triggers ASPIREAZURE003 +var roleAssignment = new AzureRoleAssignmentResource("role", ...); +``` + ## To correct this error Suppress the error with either of the following methods: diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/role-assignments.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/role-assignments.mdx index e33317806..ff6aeef28 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/role-assignments.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/role-assignments.mdx @@ -101,6 +101,15 @@ For more information, see [Azure built-in roles](https://learn.microsoft.com/azu ## Inspect role assignments programmatically +:::caution[Experimental API] +`AzureRoleAssignmentResource` is marked as experimental ([`ASPIREAZURE003`](/diagnostics/aspireazure003/)) as of Aspire 13.4. Its API shape may change in future releases. Suppress the diagnostic to use it: + +```ini title=".editorconfig" +[*.{cs,vb}] +dotnet_diagnostic.ASPIREAZURE003.severity = none +``` +::: + Aspire represents each set of role assignments as an `AzureRoleAssignmentResource` in the distributed application model. You can enumerate these resources to inspect what role assignments are configured, which Azure resource they target, and which Aspire resource owns them. This is useful in [pipeline steps](/deployment/pipelines/) that need to reason about security configuration before deployment. `AzureRoleAssignmentResource` exposes three properties: @@ -115,6 +124,7 @@ The following example shows how to add a pipeline step that runs during `WellKno ```csharp title="AppHost.cs" #pragma warning disable ASPIREAZURE001 // AzureEnvironmentResource is Experimental +#pragma warning disable ASPIREAZURE003 // AzureRoleAssignmentResource is Experimental var builder = DistributedApplication.CreateBuilder(args);