I use a tool called TALEND CSP (Microsoft Partner Center). I wrote a code snippet through which I connect to CSP via PowerShell but the search is done by a user and password and requires MFA. And in a situation where I need MFA to connect, I can not set up automation on the CSP. I would love help from someone who has made this kind of connection. I add my previous one this my code :
I use a tool called TALEND CSP (Microsoft Partner Center). I wrote a code snippet through which I connect to CSP via PowerShell but the search is done by a user and password and requires MFA. And in a situation where I need MFA to connect, I can not set up automation on the CSP. I would love help from someone who has made this kind of connection. I add my previous one this my code :
Connecting to the partner center
Connect-PartnerCenter
Getting Costumers Data
$PartnerCustomers = Get-PartnerCustomer
Create the object we'll add values to
$CustomUserInfo = New-Object -TypeName psobject
Create the array we'll add the objects to
[System.Collections.ArrayList]$LicenseReport = @()
foreach ($Customer in $PartnerCustomers){ $CustomerUsers = Get-PartnerCustomerUser -CustomerId $Customer.CustomerId | select DisplayName,UserPrincipalName,State,UserId
foreach ($CustomerUser in $CustomerUsers){ $CurrentUserLicense = Get-PartnerCustomerUserLicense -CustomerId $Customer.CustomerId -UserID $CustomerUser.UserId | select Name
$CustomUserInfo | Add-Member -MemberType NoteProperty -Name DisplayName -Value $CustomerUser.DisplayName $CustomUserInfo | Add-Member -MemberType NoteProperty -Name Email -Value $CustomerUser.UserPrincipalName
$CustomUserInfo | Add-Member -MemberType NoteProperty -Name License -Value $CurrentUserLicense.Name $CustomUserInfo | Add-Member -MemberType NoteProperty -Name State -Value $CustomerUser.State $CustomUserInfo | Add-Member -MemberType NoteProperty -Name Organization -Value $Customer.Name $CustomUserInfo.License = [string]$CustomUserInfo.License $CustomUserInfo $LicenseReport.Add(($CustomUserInfo)) $CustomUserInfo = New-Object -TypeName psobject } } $LicenseReport | Export-Csv -Path C:\CSP\PartnerCenter_Users_License_Report.csv -Encoding UTF8