This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can I add a Workflow that reports Office 365 assigned and available licenses?

I have Active Roles 7.0 with Office 365 add-on.

I want to get a report of my Office 365 tenant assigned and available licenses?

Can it be done through a Workflow?

Parents
  • Hi Alejandro,

    This can be done via PowerShell, connecting directly to Office 365.

    You can use the following snippet to make the connection to your Office 365 tenant:

    ##
    Import-Module MSOnline
    $cred = Get-Credential
    Connect-MsolService -Credential $cred
    $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionURI ps.outlook.com/.../ -Credential $cred -Authentication Basic -AllowRedirection
    Import-PSSession $session
    ##

    Using this in a workflow though, you won't have manual user input so you would need to make use of Secure String encrypted password to save the credentials securely in the script module. Please see the following TechNet blog for information on working with Secure String and passwords.

    Working with Passwords, Secure Strings and Credentials in Windows PowerShell


    Once you have your connection established, you can simply run the Get-MsolAccountSku cmdlet. This will provide a list of all available licenses. The returned information for each license that you would be interested in are the following:

    ActiveUnits
    This provides the total number of licenses for the SKU.

    ConsumedUnits
    This provides the total number of licenses that are currently assigned for this SKU.

    You can easily subtract ConsumedUnits from the ActiveUnits to retrieve the number of licenses that are not in use.

    You will need to then configure it to send out an appropriate email with the retrieved information.

    You can either configure a workflow with a Script activity to run the script, or you can create it as a Scheduled Task script and create a scheduled task to run it at a specific time repeatedly.

    I hope this helps!

    -Nick

Reply
  • Hi Alejandro,

    This can be done via PowerShell, connecting directly to Office 365.

    You can use the following snippet to make the connection to your Office 365 tenant:

    ##
    Import-Module MSOnline
    $cred = Get-Credential
    Connect-MsolService -Credential $cred
    $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionURI ps.outlook.com/.../ -Credential $cred -Authentication Basic -AllowRedirection
    Import-PSSession $session
    ##

    Using this in a workflow though, you won't have manual user input so you would need to make use of Secure String encrypted password to save the credentials securely in the script module. Please see the following TechNet blog for information on working with Secure String and passwords.

    Working with Passwords, Secure Strings and Credentials in Windows PowerShell


    Once you have your connection established, you can simply run the Get-MsolAccountSku cmdlet. This will provide a list of all available licenses. The returned information for each license that you would be interested in are the following:

    ActiveUnits
    This provides the total number of licenses for the SKU.

    ConsumedUnits
    This provides the total number of licenses that are currently assigned for this SKU.

    You can easily subtract ConsumedUnits from the ActiveUnits to retrieve the number of licenses that are not in use.

    You will need to then configure it to send out an appropriate email with the retrieved information.

    You can either configure a workflow with a Script activity to run the script, or you can create it as a Scheduled Task script and create a scheduled task to run it at a specific time repeatedly.

    I hope this helps!

    -Nick

Children
No Data