21 references to WithAppRole
Aspire.Hosting.Azure.EntraId (1)
EntraIdResourceExtensions.cs (1)
1825
return builder.
WithAppRole
(new EntraIdAppRole(value, displayName, description, allowedMemberTypes, roleId, isEnabled ?? true));
Aspire.Hosting.Azure.EntraId.Tests (18)
EntraIdPolyglotTests.cs (4)
298
.
WithAppRole
(new EntraIdAppRole("User", "User", "Can use the API."))
299
.
WithAppRole
(new EntraIdAppRole("Admin", "Administrator", "Can administer the API.", ["User", "Application"]))
300
.
WithAppRole
(new EntraIdAppRole("Reader", "Reader", "Can read data.", ["Application"], roleId))
301
.
WithAppRole
(new EntraIdAppRole("Retired", "Retired", "Being removed.", isEnabled: false));
EntraIdProvisioningTests.cs (14)
49
.
WithAppRole
(new EntraIdAppRole("User", "User", "Can use the API."))
50
.
WithAppRole
(new EntraIdAppRole("Admin", "Administrator", "Can administer the API.", ["User", "Application"]))
51
.
WithAppRole
(new EntraIdAppRole("Reader", "Reader", "Can read data.", ["Application"], new Guid("11112222-aaaa-3333-bbbb-4444cccc5555")))
52
.
WithAppRole
(new EntraIdAppRole("Retired", "Retired", "Being removed.", isEnabled: false));
65
var entra = builder.AddEntraIdApplication("entra-api").
WithAppRole
(new EntraIdAppRole("Admin", "Admin", "Admin role."));
67
Assert.Throws<ArgumentException>(() => entra.
WithAppRole
(new EntraIdAppRole("Admin", "Other", "Duplicate value.")));
68
Assert.Throws<ArgumentException>(() => entra.
WithAppRole
(new EntraIdAppRole("Has Space", "Name", "Description.")));
69
Assert.Throws<ArgumentException>(() => entra.
WithAppRole
(new EntraIdAppRole("Other", "Name", "Description.", [])));
70
Assert.Throws<ArgumentException>(() => entra.
WithAppRole
(new EntraIdAppRole("Other", "Name", "Description.", id: Guid.Empty)));
71
Assert.Throws<ArgumentException>(() => entra.
WithAppRole
(new EntraIdAppRole("Other", " ", "Description.")));
106
var entra = builder.AddEntraIdApplication("entra-api").
WithAppRole
(new EntraIdAppRole("Admin", "Admin", "Admin role."));
119
var entra = builder.AddEntraIdApplication("entra-api").
WithAppRole
(new EntraIdAppRole("A", "A", "A role.", id: id));
121
Assert.Throws<ArgumentException>(() => entra.
WithAppRole
(new EntraIdAppRole("B", "B", "B role.", id: id)));
130
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."));