Assign, update, list, or remove custom security attributes for a user
Article
Custom security attributes in Microsoft Entra ID, part of Microsoft Entra, are business-specific attributes (key-value pairs) that you can define and assign to Microsoft Entra objects. For example, you can assign custom security attribute to filter your employees or to help determine who gets access to resources. This article describes how to assign, update, list, or remove custom security attributes for Microsoft Entra ID.
Prerequisites
To assign or remove custom security attributes for a user in your Microsoft Entra tenant, you need:
Find and select the user you want to assign custom security attributes to.
In the Manage section, select Custom security attributes.
Select Add assignment.
In Attribute set, select an attribute set from the list.
In Attribute name, select a custom security attribute from the list.
Depending on the properties of the selected custom security attribute, you can enter a single value, select a value from a predefined list, or add multiple values.
For freeform, single-valued custom security attributes, enter a value in the Assigned values box.
For predefined custom security attribute values, select a value from the Assigned values list.
For multi-valued custom security attributes, select Add values to open the Attribute values pane and add your values. When finished adding values, select Done.
When finished, select Save to assign the custom security attributes to the user.
Update custom security attribute assignment values for a user
Find and select the user that has a custom security attribute assignment value you want to update.
In the Manage section, select Custom security attributes.
Find the custom security attribute assignment value you want to update.
Once you have assigned a custom security attribute to a user, you can only change the value of the custom security attribute. You can't change other properties of the custom security attribute, such as attribute set or attribute name.
Depending on the properties of the selected custom security attribute, you can update a single value, select a value from a predefined list, or update multiple values.
When finished, select Save.
Filter users based on custom security attribute assignments
You can filter the list of custom security attributes assigned to users on the All users page.
Find and select the user that has the custom security attribute assignments you want to remove.
In the Manage section, select Custom security attributes.
Add check marks next to all the custom security attribute assignments you want to remove.
Select Remove assignment.
PowerShell or Microsoft Graph API
To manage custom security attribute assignments for users in your Microsoft Entra organization, you can use PowerShell or Microsoft Graph API. The following examples can be used to manage assignments.
Assign a custom security attribute with a string value to a user
The following example assigns a custom security attribute with a string value to a user.
List all users with a custom security attribute assignment that equals a value
The following example lists all users with a custom security attribute assignment that equals a value. It retrieves users with a custom security attribute named AppCountry with a value that equals Canada. The filter value is case sensitive. You must add ConsistencyLevel=eventual in the request or the header. You must also include $count=true to ensure the request is routed correctly.
List all users with a custom security attribute assignment that starts with a value
The following example lists all users with a custom security attribute assignment that starts with a value. It retrieves users with a custom security attribute named EmployeeId with a value that starts with GS. The filter value is case sensitive. You must add ConsistencyLevel=eventual in the request or the header. You must also include $count=true to ensure the request is routed correctly.
GET https://graph.microsoft.com/v1.0/users?$count=true&$select=id,displayName,customSecurityAttributes&$filter=startsWith(customSecurityAttributes/Marketing/EmployeeId,'GS')
ConsistencyLevel: eventual
List all users with a custom security attribute assignment that does not equal a value
The following example lists all users with a custom security attribute assignment that does not equal a value. It retrieves users with a custom security attribute named AppCountry with a value that does not equal Canada. The filter value is case sensitive. You must add ConsistencyLevel=eventual in the request or the header. You must also include $count=true to ensure the request is routed correctly.
GET https://graph.microsoft.com/v1.0/users?$count=true&$select=id,displayName,customSecurityAttributes&$filter=customSecurityAttributes/Marketing/AppCountry ne 'Canada'
ConsistencyLevel: eventual
Where are custom security attribute assignments for users supported?
Custom security attribute assignments for users are supported in Microsoft Entra admin center, PowerShell, and Microsoft Graph APIs. Custom security attribute assignments are not supported in My Apps or Microsoft 365 admin center.
Who can view the custom security attributes assigned to a user?
Only users that have been assigned the Attribute Assignment Administrator or Attribute Assignment Reader roles at tenant scope can view custom security attributes assigned to any users in the tenant. Users cannot view the custom security attributes assigned to their own profile or other users. Guests cannot view the custom security attributes regardless of the guest permissions set on the tenant.
Do I need to create an app to add custom security attribute assignments?
No, custom security attributes can be assigned to user objects without requiring an application.
Why do I keep getting an error trying to save custom security attribute assignments?
You don't have permissions to assign custom security attributes to users. Make sure that you are assigned the Attribute Assignment Administrator role.
Can I assign custom security attributes to guests?
Yes, custom security attributes can be assigned to members or guests in your tenant.
Can I assign custom security attributes to directory synced users?
Yes, directory synced users from an on-premises Active Directory can be assigned custom security attributes.
Are custom security attribute assignments available for rules for dynamic membership groups?
No, custom security attributes assigned to users are not supported for configuring rules for dynamic membership groups.
Are custom security attributes the same as the custom attributes in B2C tenants?
No, custom security attributes are not supported in B2C tenants and are not related to B2C features.
Access to cloud-based workloads needs to be controlled centrally by providing a definitive identity for each user and resource. You can ensure employees and vendors have just enough access to do their job.