Skip to content

Latest commit

 

History

History
77 lines (40 loc) · 3.69 KB

azure_automation_accounts.md

File metadata and controls

77 lines (40 loc) · 3.69 KB

Azure Automation

A runbook is a set of tasks that perform some automated process in Azure Automation. Runbooks in Azure Automation are based on Windows PowerShell or Windows PowerShell Workflow, so they do anything that PowerShell can do. If an application or service has an API, then a runbook can work with it.

Automating Office 365

This description is based on:

With many users in Office365 you will have to automate different tasks:

  • Assign licenses to users
  • Set the Location attribute on users.
  • Activate archiving
  • ++

Azure Automation can do this!

To get started with Azure automation for Office 365 we need three things; PowerShell knowledge, a Azure subscription and an Office 365 subscription.

O365 User License

aac1

  • Click "Add" to create a new "Automation Account" with name "AzureAutomationO365"

aac2

Resource groups provide a way to monitor, control access, provision and manage billing for collections of assets that are required to run an application, or used by a client or company department. Azure Resource Manager (ARM) is the technology that works behind the scenes so that you can administer assets using these logical containers.

  • Click on "Assets" -> "Modules" -> "Browse gallery"

aac3

  • Search for and select "MsOnline" -> Import -> OK

aac4

Create a user (AutomateO365Cred@<tenant>.onmicrosoft.com) in AzureAD with "Global Admin" role assigned. This can be done by using Powershell script:

Back in Azure Automation -> Click "Credentials" -> Add a credential -> Enter username and password for the user (AutomateO365Cred@.onmicrosoft.com) created in AzureAD.

aac5

Click "Runbooks" -> "Add a runnbook" -> Quick create "Create a new runbook", with runbook type "powershell" and name: AutomateO365UserLicense

aac6

aac7

This PowerShell script: https://github.com/UNINETT/office365/blob/master/powershell/automateO365UserLicense.ps1 Could be used to automate O365 User License assignment. The script is based on AzureAD Security Groups. The script sets the "User Location" attribute (required to assign licenses) and then sets selected O365 licenses on the users that is populated in the security groups.

aac8

Each runbook has a Draft and a Published version. Only the Published version is available to be run, and only the Draft version can be edited. The Published version is unaffected by any changes to the Draft version. When the Draft version should be made available, then you publish it which overwrites the Published version with the Draft version.

When the runbook is published you have to activate Scheduling to run the script eg. each hour.

aac9