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

No comments

 17,367 total views,  37 views today

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 permissions 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

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

See Also:

You may also like the following SharePoint PowerShell tutorials:

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