Replies: 2 comments
-
This is the error i see when running the script above. UserPrincipalNamefirstname.lastname@domainname.com |
Beta Was this translation helpful? Give feedback.
0 replies
-
Same behavior when |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Guys.
Can anyone tell me what is wrong with this code please. I am trying to obtain the UPN name and then pass the UPN to the New-PnPPersonalSite -Email command to create the users OneDrive.
I get the error message
Attempted to perform an unauthorized operation. We dont use legacy protocols so cant use clientsecret.
I am just not sure why else to do here.
$connectionName = "AzureRunAsConnection"
$servicePrincipalConnection = Get-AutomationConnection –Name $connectionName
$TenantName = "TenanatName.onmicrosoft.com"
$AdminSiteURL="https://AdminSiteName-admin.sharepoint.com"
Connect-PnPOnline -ClientId $servicePrincipalConnection.ApplicationID -Url $AdminSiteURL -Tenant $TenantName -Thumbprint $servicePrincipalConnection.CertificateThumbprint
$OneDriveUser = Get-PnPAzureADUser | Where-Object {$_.officelocation -eq "ABC"} | select-object UserPrincipalName | sort-object UserPrincipalName
Foreach($UPN in $OneDriveUser)
{
Write-output "Adding Site Collection Admin to:" $UPN.UserPrincipalName
New-PnPPersonalSite -Email $UPN.UserPrincipalName
}
Beta Was this translation helpful? Give feedback.
All reactions