简体   繁体   中英

AADB2C : Reset active directory Member Password functionality

I am trying to update azure active directory members passwords. I have tried with both Microsoft graph api and azure ad graph api. However I am not able to update members password. I have tried with all the permission. Please refer below error:

{
    "odata.error": {
        "code": "Authorization_RequestDenied",
        "message": {
            "lang": "en",
            "value": "Insufficient privileges to complete the operation."
        }
    }
}

Could you please help me to find out the solution?

If you want to have enough privileges to reset users password, you need to assign Company Administrators Role to your Service principal. You can refer to this document to do that.

  1. Use AAD Powershell to Connect AAD:

Connect-AzureAD

  1. Get the Role of Company Administrator:

$role = Get-AzureADDirectoryRole | Where-Object {$_.displayName -eq 'Company Administrator'}

  1. Assign the role to your SP:

Add-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $yoursp.ObjectId

  1. Get a new access token and Rest the User Password in postman:

在此处输入图片说明

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM