public override void ExecuteCmdlet()
{
FilterRoleAssignmentsOptions options = new FilterRoleAssignmentsOptions()
{
Scope = Scope,
RoleDefinitionName = RoleDefinitionName,
RoleDefinitionId = RoleDefinitionId == Guid.Empty ? null : RoleDefinitionId.ToString(),
ADObjectFilter = new ADObjectFilterOptions
{
UPN = SignInName,
SPN = ServicePrincipalName,
Id = ObjectId == Guid.Empty ? null : ObjectId.ToString(),
},
ResourceIdentifier = new ResourceIdentifier()
{
ParentResource = ParentResource,
ResourceGroupName = ResourceGroupName,
ResourceName = ResourceName,
ResourceType = ResourceType,
Subscription = string.IsNullOrEmpty(ResourceGroupName) ? null : DefaultProfile.Context.Subscription.Id.ToString()
},
ExpandPrincipalGroups = ExpandPrincipalGroups.IsPresent,
IncludeClassicAdministrators = IncludeClassicAdministrators.IsPresent,
ExcludeAssignmentsForDeletedPrincipals = true
};
List<PSRoleAssignment> ra = PoliciesClient.FilterRoleAssignments(options, DefaultProfile.Context.Subscription.Id.ToString());
WriteObject(ra, enumerateCollection: true);
}
}