none
office 365 billing api RRS feed

  • Question

  • We have a customer which has multiple Companies (Cost centers) so the cost of their Office 365 accounts are billed back to each Company.  Every month, we have to create a custom report in Excel, but this process is manual.  For efficiency purposes, I would like to automate this process.

    I would like to know if any office 365 API I can use which can provide current licensing details and billing details based on monthly bases. Based on Company(Cost Center), I would then calculate how many users use the Plan 1, 2, or E3 Plan and present this information to the customer for internal billing purposes.

    Note: As of now we dont have Company field within Office 365 to organize the report, but we would like to do so.

    Tuesday, May 10, 2016 10:03 PM

All replies

  • Hi, I create a script in PowerShell that get a lot of information from Office 365:

    SlideShare

    #Copy all code below on PowerShell #If you get the error: #Import-PSSession : Files cannot be loaded because running scripts is disabled on this system. Provide a valid certificate with which to sign the files. #Execute the command: (as Administrator): Set-ExecutionPolicy RemoteSigned #_____________________________________________________ #Script Start (No Administrator needed) #Path and name of the report $export = "$env:USERPROFILE\Desktop\exchange.csv" #User and pass from the Office 365 Administrator $UserCredential = Get-Credential #Azure Active Directory Module. #If you get an error: https://technet.microsoft.com/en-us/library/dn975125.aspx Import-Module MSOnline #Create Exchange Online connection $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session Connect-MsolService -Credential $UserCredential #END OF REMOTE CONNECTION #_____________________________________________________ #Licenses Report $Report=@() $Mailboxes = Get-Mailbox -identity "paulo.paim@quirius.com.br" #One account (Comment the line below) #$Mailboxes = Get-Mailbox -ResultSize Unlimited | where {$_.RecipientTypeDetails -ne "DiscoveryMailbox"}  #All accounts (Comment the line above) foreach ($mailbox in $Mailboxes){ $UserStat = Get-User -identity $mailbox.UserPrincipalName $MailboxStat = Get-MailboxStatistics $mailbox.UserPrincipalName $LastLogonTime = $MailboxStat.LastLogonTime  $MSOLUSER = Get-MsolUser -UserPrincipalName $mailbox.UserPrincipalName foreach($license in $MSOLUSER.Licenses){         $Report += New-Object PsObject -Property @{                     "User"="$($mailbox.DisplayName)";                     "Mail"="$($mailbox.UserPrincipalName)";                     "Company"="$($UserStat.Company)";                     "Department"="$($UserStat.Department)";                     "Manager"="$($UserStat.Manager)";                     "Title"="$($UserStat.Title)";                     "AccountSKUID"="$($license.AccountSKUid)"                   }   } } $Report | Export-CSV $export -NoTypeInformation




    • Edited by Paulo_Paim Thursday, October 6, 2016 12:15 AM
    Wednesday, October 5, 2016 11:21 PM