Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Can't Manage Customer Tenants via Powershell. #417

@itwguthub

Description

@itwguthub

So we run a script for monthly reporting via powershell for all our customers. The report pulls out all licensed users, and what licenses the customer tenant has. This has been working for ages, but all access via powershell has stopped on the 1st of November. ( I have been passed from Partner support to Azure to 365 and the last engineer informed me I need to come here)

We can still fully manage all customers via the Partner portal and Lighthouse, but powershell access has been revoked.

When running our script we just get " access denied "

Here is the script
Connect-MsolService $customers = Get-MsolPartnerContract -All Write-Host "Found $($customers.Count) customers for $((Get-MsolCompanyInformation).displayname)." -ForegroundColor DarkGreen $CSVpath = "C:\Temp\UserLicenseReportOctober.csv" foreach ($customer in $customers) { Write-Host "Retrieving license info for $($customer.name)" -ForegroundColor Green $licensedUsers = Get-MsolUser -TenantId $customer.TenantId -All | Where-Object {$_.islicensed } foreach ($user in $licensedUsers) { Write-Host "$($user.displayname)" -ForegroundColor Yellow $licenses = $user.Licenses $licenseArray = $licenses | foreach-Object {$_.AccountSkuId} $licenseString = $licenseArray -join ", " Write-Host "$($user.displayname) has $licenseString" -ForegroundColor Blue $licensedSharedMailboxProperties = [pscustomobject][ordered]@{ CustomerName = $customer.Name DisplayName = $user.DisplayName Licenses = $licenseString } $licensedSharedMailboxProperties | Export-CSV -Pat h $CSVpath -Append -NoTypeInformation } }
accessdenied

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions