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

[Fixed]: Remove-MsolServicePrincipalCredential : Access Denied. You do not have permissions

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


Discover more from Global SharePoint

Subscribe to get the latest posts sent to your email.

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