Remove-MsolServicePrincipalCredential - Access Denied. You do not have permissions to call this cmdlet

[Fixed]: Remove-MsolServicePrincipalCredential : Access Denied. You do not have permissions to call this cmdlet.

No comments

Loading

The “Remove-MsolServicePrincipalCredential : Access Denied” error – when we try to connect to and run the Connect-MsolService command in the Microsoft Azure Active Directory Module for Windows PowerShell to connect to a Microsoft cloud service such as Office 365, Microsoft Azure, or Microsoft Intune, this will not be successful.  And you might receive this error – “Connect-MsolService : Access Denied. You do not have permission to call this cmdlet”.

And the similar way, when we try to run this cmdlet “Remove-MsolServicePrincipalCredential -KeyIds $keys.KeyId -AppPrincipalId $clientId”, we will get the error “Remove-MsolServicePrincipalCredential : Access Denied. You do not have permission to call this cmdlet.”


Connect-MsolService
$clientId = "clientID"
$keys = Get-MsolServicePrincipalCredential -AppPrincipalId $clientId -ReturnKeyValues $true
$keys
Remove-MsolServicePrincipalCredential -KeyIds $keys.KeyId -AppPrincipalId $clientId

Solution – Fix (Remove-MsolServicePrincipalCredential)

This issue can be resolved by adding the member/user to an administrator role within Azure or a Global Administrator role in Office 365 tenant. So to fix this issue, the PowerShell command should be run with the administrative account.

See Also: Remove-MsolServicePrincipalCredential

You may also like the following SharePoint PowerShell tutorials:

Buy the premium version of SharePoint Online & Office 365 administration eBook from here:

About Post Author

Do you have a better solution or question on this topic? Please leave a comment