PowerShell + Office 365 SKUs + Cireson License Class
Was doing some messing trying to synchronize Office 365 SKU's into the Cireson License object and came up with the following quick and dirty script. For per-user assignments, it will add the user object to the license assignment section.
Happy to take all feedback on board!
As usual with all things from the internet, review the script prior to testing in your playground.
In case you missed the above, it's quick; and dirty! :-)
PowerShell Requirements:
MSOnline
SMLets
Script Changes:
Change line 37 to include your UPN pattern
Change line 59 to your SCSM server name
Issues:
O365 module doesn't expose expiry dates on plans sadly.
Error checking could be more robust.
https://gist.github.com/anonymous/20a6354cdcc884c6b3b3f3c2bb4efe79#file-cireson-o365-ps1
John
Comments
https://community.cireson.com/discussion/602/azure-active-directory-powershell-in-sma#latest
The MSOL Sign-In Assistant is installed on my SMA server and it looks to be v1.0.0 of the module.
2. Yes please! Could you try to invoke this against your SCSM WF server from SMA? (i.e. inlinescript against your WF server).
Not sure what your plan was, but I was thinking it simplest to invoke from WF server where SMlets and a mgmt server will already be to write into AM.
Published it then hit start!
On the update problem, it's creating the objects and assigning memberships without issue. What I'm querying is the best way to handle cases where users have licensed removed via O365 Portal. For now, in DEV, I'm just scrubbing all the user relationships and repopulating but it's not elegant!
For reference sake here's a link to the DEV workflow I'm using in my SMA server.
I think we're doing the exact same thing though.
Change line 4 to the SCSM server.
Change line 5 to reflect valid O365 credentials to query license state.
https://gist.github.com/anonymous/2a55a41c250c161767e06f8742b4cf8a#file-msol-synclicenses-ps1
With respect to your update/delete processes, I'm thinking something along the lines of leveraging Compare-Object. Now that I have this working I should be able to participate in this conversation!
I was hoping to use compare-object too but can't distill it down into a nice enough structure to compare! I'm sure we'll figure something out!