Closed hang10z closed 2 years ago
Hmm strange on my side this is working. But do I assume correctly, that you had customized the command with your ClientID, TenantId and Secret?
I'm getting the same error message as hang10z. I have verified I'm using the correct ClientId, ClientSecret and TenantId for the application registration I created with New-M365DocAppRegistration. I'm using PowerShell 5.
Edit: I played around with it a bit and if I call Get-MsalToken directly and pass the parameters to it, I get a token back. (Literally just replace Connect-M365Doc with Get-MsalToken). It looks like you're converting ClientSecret to a regular string in the param section - [string]$ClientSecret. If I change that to [Security.SecureString]$ClientSecret, everything works.
I have fixed this in the code. Will publish a new version soon.
Fixed in actual published version
Tried to use this command using my app values and tenant id: Connect-M365Doc -ClientId '00000000-0000-0000-0000-000000000000' -ClientSecret (ConvertTo-SecureString 'SuperSecretString' -AsPlainText -Force) -TenantId '00000000-0000-0000-0000-000000000000'
I get the following error:
Cannot process argument transformation on parameter 'ClientSecret'. Cannot convert the | "System.Security.SecureString" value of type "System.String" to type "System.Security.SecureString".