问题
I am trying to use a service principal I have created in AzureAD to connect via a PowerShell script. I created the SP successfully, created the key, and also created a self signed cert and associated it with the account. I know how to use Connect-AzureAD but Connect-MSOLservice doesn't seem to allow me to enter the values needed.
I have tried using the standard connection string as you would with Connect-AzureAD but it doesn't seem to take the same input.
Connect-MsolService -TenantId "xxxx" -ApplicationId "xxxx" -CertificateThumbprint "xxxx"
I'm hoping someone can show me or point me in the direction of how to use the Connect-MSOLservice command using either the key or cert associated with the Service Principal.
回答1:
It's not possible to use service principal to Connect AAD via "Connect-MSOLservice"
Why:
Actually, MSOL Powershell is Office 365 Powershell. It's designed for managing O365 online services. Therefore, it could only be logged in via Office 365 users.
Hence, you cannot use Connect-MsolService with Guest users and service principals because they're not O365 users.
来源:https://stackoverflow.com/questions/55747310/connecting-with-service-principal-using-connect-msolservice