AzureResourceExtensions Methods
Class Methods 3 members
Provides extension methods for adding Azure resources to the application model.
ClearDefaultRoleAssignments(IResourceBuilder<T>) Section titled ClearDefaultRoleAssignments(IResourceBuilder<T>) extension IResourceBuilder<T> Clears all default role assignments for the specified Azure resource.
public static class AzureResourceExtensions{ public static IResourceBuilder<T> ClearDefaultRoleAssignments<T>( this IResourceBuilder<T> builder) { // ... }}Parameters
builder IResourceBuilder<T> The resource builder. Returns
IResourceBuilder<T> The configured ApplicationModel.IResourceBuilder`1. Remarks
This method removes all default role assignments from the Azure resource. This can be useful when role assignments can't be created, for example on existing resources where you don't have permission to create the assignments.
Examples
Clear default role assignments for an Azure Key Vault resource:
var builder = DistributedApplication.CreateBuilder(args);
var keyVault = builder.AddAzureKeyVault("keyvault") .RunAsExisting("kv-dev-secrets", "rg-keyvault") .ClearDefaultRoleAssignments();
var api = builder.AddProject<Projects.Api>("api") .WithReference(keyVault);GetBicepIdentifier(IAzureResource) Section titled GetBicepIdentifier(IAzureResource) extension string Gets the Bicep identifier for the Azure resource.
public static class AzureResourceExtensions{ public static string GetBicepIdentifier( this IAzureResource resource) { // ... }}Parameters
resource IAzureResource The Azure resource. Returns
string A valid Bicep identifier. PublishAsConnectionString(IResourceBuilder<T>) Section titled PublishAsConnectionString(IResourceBuilder<T>) extension IResourceBuilder<T> Changes the resource to be published as a connection string reference in the manifest.
public static class AzureResourceExtensions{ public static IResourceBuilder<T> PublishAsConnectionString<T>( this IResourceBuilder<T> builder) { // ... }}Parameters
builder IResourceBuilder<T> The resource builder. Returns
IResourceBuilder<T> The configured ApplicationModel.IResourceBuilder`1.