Microsoft.Azure.Commands.Resources.RemoveAzureRoleAssignmentCommand.ExecuteCmdlet C# (CSharp) Method

ExecuteCmdlet() public method

public ExecuteCmdlet ( ) : void
return void
        public override void ExecuteCmdlet()
        {
            IEnumerable<PSRoleAssignment> roleAssignments = null;
            FilterRoleAssignmentsOptions options = new FilterRoleAssignmentsOptions()
            {
                Scope = Scope,
                RoleDefinitionName = RoleDefinitionName,
                RoleDefinitionId = RoleDefinitionId == Guid.Empty ? null : RoleDefinitionId.ToString(),
                ADObjectFilter = new ADObjectFilterOptions
                {
                    UPN = SignInName,
                    Id = ObjectId == Guid.Empty ? null : ObjectId.ToString(),
                    SPN = ServicePrincipalName
                },
                ResourceIdentifier = new ResourceIdentifier()
                {
                    ParentResource = ParentResource,
                    ResourceGroupName = ResourceGroupName,
                    ResourceName = ResourceName,
                    ResourceType = ResourceType,
                    Subscription = DefaultProfile.Context.Subscription.Id.ToString()
                },
                ExcludeAssignmentsForDeletedPrincipals = false,
                // we should never expand principal groups in the Delete scenario
                ExpandPrincipalGroups = false,
                // never include classic administrators in the Delete scenario
                IncludeClassicAdministrators = false
            };

            ConfirmAction(
                ProjectResources.RemovingRoleAssignment,
                string.Empty,
                () =>
                {
                    roleAssignments = PoliciesClient.RemoveRoleAssignment(options,
                        DefaultProfile.Context.Subscription.Id.ToString());
                    if (PassThru)
                    {
                        WriteObject(roleAssignments, enumerateCollection: true);
                    }
                });

        }
    }
RemoveAzureRoleAssignmentCommand