Primary keys are managed by Mendix. You don’t add them manually. They are created automatically when needed. Which often is the objectID (internal). Perhaps you are looking for indexes? https://docs.mendix.com/refguide/indexes/
By following the below screen you will be able to define primary key on attribute.