43 instantiations of EntraIdAppRole
Aspire.Hosting.Azure.EntraId (1)
EntraIdResourceExtensions.cs (1)
1985return builder.WithAppRole(new EntraIdAppRole(value, displayName, description, allowedMemberTypes, roleId, isEnabled ?? true));
Aspire.Hosting.Azure.EntraId.Tests (40)
EntraIdAppRoleAssignmentTests.cs (16)
30.WithAppRole(new EntraIdAppRole("Orders.Read", "Read", "Read orders.", ["Application"])) 31.WithAppRole(new EntraIdAppRole("Orders.Write", "Write", "Write orders.", ["User", "Application"], 61.WithAppRole(new EntraIdAppRole("Orders.Read", "Read", "Read.", ["Application"])) 62.WithAppRole(new EntraIdAppRole("UserOnly", "User", "User.")) 63.WithAppRole(new EntraIdAppRole("Disabled", "Disabled", "Disabled.", ["Application"], isEnabled: false)); 101.WithAppRole(new EntraIdAppRole("Read", "Read", "Read.", ["Application"])) 112var role = new EntraIdAppRole("Read", "Read", "Read.", ["Application"]); 132.WithAppRole(new EntraIdAppRole("Read", "Read", "Read.", ["Application"])) 149.WithAppRole(new EntraIdAppRole("Read", "Read", "Read.", ["Application"])) 166.WithAppRole(new EntraIdAppRole("Read", "Read", "Read.", ["Application"])) 181.WithAppRole(new EntraIdAppRole("Read", "Read", "Read.", ["Application"])); 201.WithAppRole(new EntraIdAppRole("Read", "Read", "Read.", ["Application"])) 221.WithAppRole(new EntraIdAppRole("Read", "Read", "Read.", ["Application"])); 266.WithAppRole(new EntraIdAppRole("Read.All", "Read", "Read.", ["Application"])) 267.WithAppRole(new EntraIdAppRole("Read-All", "Read", "Read.", ["Application"])) 268.WithAppRole(new EntraIdAppRole("All", "All", "All.", ["Application"]))
EntraIdPolyglotTests.cs (4)
387.WithAppRole(new EntraIdAppRole("User", "User", "Can use the API.")) 388.WithAppRole(new EntraIdAppRole("Admin", "Administrator", "Can administer the API.", ["User", "Application"])) 389.WithAppRole(new EntraIdAppRole("Reader", "Reader", "Can read data.", ["Application"], roleId)) 390.WithAppRole(new EntraIdAppRole("Retired", "Retired", "Being removed.", isEnabled: false));
EntraIdProvisioningTests.cs (20)
187"role" => entra.WithAppRole(new EntraIdAppRole("Reader", "Reader", "Read data.")), 280.WithAppRole(new EntraIdAppRole("User", "User", "Can use the API.")) 281.WithAppRole(new EntraIdAppRole("Admin", "Administrator", "Can administer the API.", ["User", "Application"])) 282.WithAppRole(new EntraIdAppRole("Reader", "Reader", "Can read data.", ["Application"], new Guid("11112222-aaaa-3333-bbbb-4444cccc5555"))) 283.WithAppRole(new EntraIdAppRole("Retired", "Retired", "Being removed.", isEnabled: false)); 296var entra = builder.AddEntraIdApplication("entra-api").WithAppRole(new EntraIdAppRole("Admin", "Admin", "Admin role.")); 298Assert.Throws<ArgumentException>(() => entra.WithAppRole(new EntraIdAppRole("Admin", "Other", "Duplicate value."))); 299Assert.Throws<ArgumentException>(() => entra.WithAppRole(new EntraIdAppRole("Has Space", "Name", "Description."))); 300Assert.Throws<ArgumentException>(() => entra.WithAppRole(new EntraIdAppRole("Other", "Name", "Description.", []))); 301Assert.Throws<ArgumentException>(() => entra.WithAppRole(new EntraIdAppRole("Other", "Name", "Description.", id: Guid.Empty))); 302Assert.Throws<ArgumentException>(() => entra.WithAppRole(new EntraIdAppRole("Other", " ", "Description."))); 314Assert.Throws<ArgumentException>(() => new EntraIdAppRole(value, "Name", "Description.")); 323Assert.Equal(value, new EntraIdAppRole(value, "Name", "Description.").Value); 329Assert.Throws<ArgumentException>(() => new EntraIdAppRole(new string('a', 121), "Name", "Description.")); 330Assert.Equal(120, new EntraIdAppRole(new string('a', 120), "Name", "Description.").Value.Length); 337var entra = builder.AddEntraIdApplication("entra-api").WithAppRole(new EntraIdAppRole("Admin", "Admin", "Admin role.")); 340Assert.Throws<NotSupportedException>(() => roles.Add(new EntraIdAppRole("Other", "Other", "Other role."))); 350var entra = builder.AddEntraIdApplication("entra-api").WithAppRole(new EntraIdAppRole("A", "A", "A role.", id: id)); 352Assert.Throws<ArgumentException>(() => entra.WithAppRole(new EntraIdAppRole("B", "B", "B role.", id: id))); 361Assert.Throws<InvalidOperationException>(() => entra.WithAppRole(new EntraIdAppRole("Admin", "Admin", "Admin role.")));
EntraId.AppHost (2)
AppHost.cs (2)
33.WithAppRole(new EntraIdAppRole("User", "User", "Can sign in and view the playground.")) 34.WithAppRole(new EntraIdAppRole("Admin", "Administrator", "Can administer the playground."));
14 references to EntraIdAppRole
Aspire.Hosting.Azure.EntraId (12)
EntraIdApplicationResource.cs (9)
428internal EntraIdAppRole GetAssignableAppRole(string value) 430var role = AppRoles.SingleOrDefault(role => string.Equals(role.Value, value, StringComparison.Ordinal)) 441internal IReadOnlyList<(AzureUserAssignedIdentityResource Identity, EntraIdAppRole Role)> GetManagedIdentityRoleAssignments(bool requireIdentity) 443var assignments = new List<(AzureUserAssignedIdentityResource Identity, EntraIdAppRole Role)>(); 471foreach (var role in roles) 826public IReadOnlyList<EntraIdAppRole> AppRoles => _appRoles.AsReadOnly(); 828private readonly List<EntraIdAppRole> _appRoles = []; 830internal void AddAppRole(EntraIdAppRole role) => _appRoles.Add(role); 837private static MicrosoftGraphAppRole CreateAppRole(EntraIdApplicationResource resource, EntraIdAppRole role)
EntraIdAppRole.cs (1)
19/// Initializes a new instance of the <see cref="EntraIdAppRole"/> class.
EntraIdResourceExtensions.cs (1)
1925EntraIdAppRole role)
Provisioning\EntraIdSymbolNames.cs (1)
60public string ManagedIdentityRoleAssignment(AzureUserAssignedIdentityResource identity, EntraIdAppRole role, Guid roleId) =>
Aspire.Hosting.Azure.EntraId.Tests (2)
EntraIdAppRoleAssignmentTests.cs (1)
112var role = new EntraIdAppRole("Read", "Read", "Read.", ["Application"]);
EntraIdProvisioningTests.cs (1)
339var roles = Assert.IsAssignableFrom<IList<EntraIdAppRole>>(entra.Resource.AppRoles);