I'm using MS Graph APIs to manage users in my B2C directory. I'm able to create/update the users but I cannot delete a user. I get this error message "Insufficient privileges to complete the operation". I have made sure the client app has "Directory.ReadWrite.All" API permissions.
I don't know what else I'm missing here. There are couple other threads where adding "Company Administrator" (does not exist anymore) or "User Administrator" role to the Service principal associated with my app registration. My client app runs as a background application. How can I access the Service principal associated with my app registration?
Following is the code snippet
await graphClientB2C.Users[b2cUserId].Request().DeleteAsync();