43 instantiations of EntraIdAppRole
Aspire.Hosting.Azure.EntraId (1)
EntraIdResourceExtensions.cs (1)
1985
return 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"]))
112
var 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));
296
var entra = builder.AddEntraIdApplication("entra-api").WithAppRole(new
EntraIdAppRole
("Admin", "Admin", "Admin role."));
298
Assert.Throws<ArgumentException>(() => entra.WithAppRole(new
EntraIdAppRole
("Admin", "Other", "Duplicate value.")));
299
Assert.Throws<ArgumentException>(() => entra.WithAppRole(new
EntraIdAppRole
("Has Space", "Name", "Description.")));
300
Assert.Throws<ArgumentException>(() => entra.WithAppRole(new
EntraIdAppRole
("Other", "Name", "Description.", [])));
301
Assert.Throws<ArgumentException>(() => entra.WithAppRole(new
EntraIdAppRole
("Other", "Name", "Description.", id: Guid.Empty)));
302
Assert.Throws<ArgumentException>(() => entra.WithAppRole(new
EntraIdAppRole
("Other", " ", "Description.")));
314
Assert.Throws<ArgumentException>(() => new
EntraIdAppRole
(value, "Name", "Description."));
323
Assert.Equal(value, new
EntraIdAppRole
(value, "Name", "Description.").Value);
329
Assert.Throws<ArgumentException>(() => new
EntraIdAppRole
(new string('a', 121), "Name", "Description."));
330
Assert.Equal(120, new
EntraIdAppRole
(new string('a', 120), "Name", "Description.").Value.Length);
337
var entra = builder.AddEntraIdApplication("entra-api").WithAppRole(new
EntraIdAppRole
("Admin", "Admin", "Admin role."));
340
Assert.Throws<NotSupportedException>(() => roles.Add(new
EntraIdAppRole
("Other", "Other", "Other role.")));
350
var entra = builder.AddEntraIdApplication("entra-api").WithAppRole(new
EntraIdAppRole
("A", "A", "A role.", id: id));
352
Assert.Throws<ArgumentException>(() => entra.WithAppRole(new
EntraIdAppRole
("B", "B", "B role.", id: id)));
361
Assert.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)
428
internal
EntraIdAppRole
GetAssignableAppRole(string value)
430
var
role = AppRoles.SingleOrDefault(role => string.Equals(role.Value, value, StringComparison.Ordinal))
441
internal IReadOnlyList<(AzureUserAssignedIdentityResource Identity,
EntraIdAppRole
Role)> GetManagedIdentityRoleAssignments(bool requireIdentity)
443
var assignments = new List<(AzureUserAssignedIdentityResource Identity,
EntraIdAppRole
Role)>();
471
foreach (
var
role in roles)
826
public IReadOnlyList<
EntraIdAppRole
> AppRoles => _appRoles.AsReadOnly();
828
private readonly List<
EntraIdAppRole
> _appRoles = [];
830
internal void AddAppRole(
EntraIdAppRole
role) => _appRoles.Add(role);
837
private static MicrosoftGraphAppRole CreateAppRole(EntraIdApplicationResource resource,
EntraIdAppRole
role)
EntraIdAppRole.cs (1)
19
/// Initializes a new instance of the <see cref="
EntraIdAppRole
"/> class.
EntraIdResourceExtensions.cs (1)
1925
EntraIdAppRole
role)
Provisioning\EntraIdSymbolNames.cs (1)
60
public string ManagedIdentityRoleAssignment(AzureUserAssignedIdentityResource identity,
EntraIdAppRole
role, Guid roleId) =>
Aspire.Hosting.Azure.EntraId.Tests (2)
EntraIdAppRoleAssignmentTests.cs (1)
112
var
role = new EntraIdAppRole("Read", "Read", "Read.", ["Application"]);
EntraIdProvisioningTests.cs (1)
339
var roles = Assert.IsAssignableFrom<IList<
EntraIdAppRole
>>(entra.Resource.AppRoles);