Skip to content

Intune-Set-PrimaryUsers.ps1 - Using with ClientID & ClientSecret => Cannot convert the "XXX" value of type "System.String" to type "System.Security.SecureString" #35

@eggertom

Description

@eggertom

Hi guys - i am totally confused as i am not getting this script running with app-only authentication....

what i am doing wrong?
i specifiy the

$AuthTenantId in cleartext
$AuthClientId in cleartext

and also played around with getting this $AuthClientSecret somehow specified in the script

$AuthClientSecret in cleartext => does not work as it expects a type "System.Security.SecureString"

then i tried to convert the clear text secret into a secure.string

[System.Security.SecureString]$AuthClientSecret = (ConvertTo-SecureString "XXX" -AsPlainText -Force)
=> this try also runs into an error or let me say correctly it seems that he is then switching back to the Interactive prompt...

my last try was to get it running with
$ClientSecretCredential = New-Object System.Management.Automation.PSCredential ($ClientId, $ClientSecretSecure)

but i also failed...

thx for your help guys.
br tom

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions