41,235 total views, 1 views today
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:
- [Fixed]: The term ‘Get-MsolServicePrincipal’ is not recognized as the name of a cmdlet, function, script file,
- [Verified]: Find all InfoPath forms in SharePoint using PowerShell
- [Verified]: Remove recycle bin items in SharePoint using PowerShell
- [Verified]: Cancel SharePoint workflows using PowerShell
- SharePoint Online: Remove custom app using PnP PowerShell
- Office 365: How to create content type in SharePoint Online using PowerShell?
- Office 365: How to create document library in SharePoint Online using PowerShell?
- Export SharePoint user information list to CSV(Excel) file using PowerShell
- How to fix “The term ‘Get-MsolUser’ is not recognized as the name of a cmdlet”
- How to fix the “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function” PowerShell error
- How to hide quick launch menu in SharePoint online using PnP PowerShell
- Edit user Permission is greyed Out SharePoint Online
- Get workflow inventory from SharePoint online using PowerShell CSOM
- Create a modern team site using PnP PowerShell in SharePoint
- In 2 steps convert a classic SharePoint page to modern using PnP
- SharePoint Online: Delete All Files from document library for the given date – PowerShell CSOM
- Create SharePoint online list using PnP provisioning template
- SharePoint Automation: PowerShell script to get remote server information
- Office 365: Retrieve hub sites and associated sites using PnP Powershell
- SharePoint Online Automation – O365 – Upload files to document library using PowerShell CSOM
- SharePoint Online Automation – O365 – Create multiple items in a list using PowerShell CSOM
- SharePoint Online Automation – O365 – Update document library metadata using PowerShell CSOM
- What is Azure PowerShell?