Reputation: 57
I am having some issues using this ps script. Would you please explain what are the Permissions/rights are prerequisites to run the ps script.At the same time is it mandatory to have Azure Subscription? I have an Azure account under my organization's tenant Name. But in my account I dont see any subscription ID. I created an app from Menu>Azure Active Directory> APP Registration. Then got permission granted for the below two with the help of O365 Admin of my organization: Reports.Readers.all User.Read I have "Readers Role ". Is it sufficient to run those script to have O365 usages report, teams usage Report and all other reports mentioned in the link you shared above? Please help me out to resolve this. I am struggling with this for couple of weeks without any luck! :( My powerShell version is 5.1.
When i am running the PS script I am getting error:(this is the script: https://gallery.technet.microsoft.com/Get-Office365-usage-f955ade4)
WARNING: Unable to load ADAL assemblies. Update the MSOnline module by running Install-Module MSOnline -Force -AllowClobber Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:\Program Files\WindowsPowerShell\Modules\MSOnline\1.1.183.57\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll' or one of its dependencies. The system cannot find the file specified."At C:\Users\MRAHM11\Documents\Projects\O365_Usage_PowerShell\Script_DwnLd\Get-Office365Report.ps1:256 char:21 [System.Reflection.Assembly]::LoadFrom($adalforms) | Out- ... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CategoryInfo : NotSpecified: (:) [], MethodInvocationException FullyQualifiedErrorId : FileNotFoundException
When I am executing PS> Install-Module MSOnline -Force -AllowClobber Getting error:
WARNING: The version '1.1.183.57' of module 'MSOnline' is currently in use. Retry the operation after closing the applications.
What are the wrong steps I am taking? Is my user permission is okey or need to have different user role like Global Reader or something else? Please help..
Upvotes: 0
Views: 997
Reputation: 6508
Your issue is related to ADAL dll loading in MSOnline
powershell module, not any permission so far as you have not reached to that point yet. But note that MSOnline
is older V1 PowerShell module for Azure Active Directory which uses deprecated ADAL library. I suggest you NOT to use MSOnline
anymore. Customers are encouraged to use the newer Azure Active Directory V2 PowerShell module* instead of this module. For details, refer Use PowerShell to create reports for Microsoft 365.
Install-Module -Name AzureAD
For newer V2 based script for O365 usage report, please refer https://gallery.technet.microsoft.com/Get-O365UsageReports-954fb5a3
*v2 doesn't require -AzureTenantADName or ADAL dlls.
Regarding permissions, Reports.Read.All
is good enough.
Details on working with the Office 365 Usage reports via Microsoft Graph API: https://developer.microsoft.com/graph/docs/api-reference/v1.0/resources/report
Details on working with the Office 365 Usage reports via beta API in Microsoft Graph: https://developer.microsoft.com/graph/docs/api-reference/beta/resources/report
*beta API has some additional Teams reports API.
Upvotes: 1
Reputation: 28930
First try removing those modules..
Remove-Module -Name "MSOnline" -force
Uninstall-Module -Name "MSOnline" -AllVersions -force
and then install
Install-Module MSOnline -Force -AllowClobber
Upvotes: 1