38 references to WithAppRole
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 (35)
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"]))
113
var api = builder.AddEntraIdApplication("entra-api").
WithAppRole
(role);
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 (15)
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.")));
337
var entra = builder.AddEntraIdApplication("entra-api").
WithAppRole
(new EntraIdAppRole("Admin", "Admin", "Admin 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."));