Jump to content

Create custom attributes that uses multiple choices in Microsoft Purview


Recommended Posts

Guest schandra
Posted

We know that Managed attributes in Microsoft Purview is helpful to enrich technical assets and help a data consumer get more context about the asset to which it is applied.

 

 

 

In order to create these Managed Attributes, the Purview UI does a very good job and is probably the easiest and recommended approach. At the same time, Purview also offers the flexibility to create them using APIs. Here is an example: Use new APIs available with Atlas 2.2. - Microsoft Purview | Microsoft Learn

 

 

 

But, I was looking for a way to create an attribute that uses multiple choice in the “Field type” rather than using the text (from the example in the link above). Below is an approach that worked for me (thanks to a few colleagues that helped).

 

 

 

The approach involves 2 typeDef API calls:

 

 

 

Create a ENUM typeDef: (this step is optional if you already have the ENUM created)

 

 

 

POST: api/atlas/v2/types/typedefs

 

{

 

"enumDefs": [

 

{

 

"name": "ATTRIBUTE_ENUM_CUSTOMNAME",

 

"elementDefs": [

 

{

 

"value": "choice1",

 

"ordinal": 0

 

},

 

{

 

"value": "choice2",

 

"ordinal": 1

 

},

 

{

 

"value": "choice3",

 

"ordinal": 2

 

}

 

]

 

}

 

]

 

}

 

Create/Update Business MetaData typedef:

 

 

 

POST/PUT api/atlas/v2/types/typedefs

 

{ "businessMetadataDefs":

[

{

"category": "BUSINESS_METADATA",

"name": "<Managed Attribute group name to be created>",

"description": "<Any description>",

"attributeDefs":

[

{

"cardinality": "SINGLE",

"isUnique": false,

"options":

{

"applicableEntityTypes": "[\"Asset\"]"

},

"name": "multi_choice_attr",

"typeName": "array<ATTRIBUTE_ENUM_CUSTOMNAME>",

"isOptional": true

}

]

}

]

}

 

Note: The prefix "ATTRIBUTE_ENUM_" is mandatory for now. The output in the UI should look like the below:

 

largevv2px999.jpg.e0f7c7e61f72db12cd1d0773c7a4a3f0.jpg

 

Once created, you should now be able to assign the above attribute to assets.

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...