Skip to content

Commit 1d66274

Browse files
committed
Adding new file for managing O365
1 parent ef32b4e commit 1d66274

File tree

9 files changed

+162
-27
lines changed

9 files changed

+162
-27
lines changed

articles/automation/TOC.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
displayName: certificate renewal
1818
- name: Configure authentication with AWS
1919
href: automation-config-aws-account.md
20-
- name: Encryption of secure assets in Azure Automation
20+
- name: Use Azure AD in Azure Automation to authenticate to Azure
21+
href: automation-use-azure-ad.md
22+
- name: Manage Office 365 services using Azure Automation
23+
href: automation-manage-office-365.md
24+
- name: Encrypt secure assets in Azure Automation
2125
href: automation-secure-asset-encryption.md
2226
- name: Manage role-based access control
2327
href: automation-role-based-access-control.md
2428
displayName: RBAC
25-
- name: Use Azure AD in Azure Automation to authenticate to Azure
26-
href: automation-use-azure-ad.md
2729
- name: Move your Automation Account to another Subscription
2830
href: how-to/move-account.md
2931
- name: Automate onboarding of Automation Services
@@ -319,9 +321,9 @@
319321
href: shared-resources/credentials.md
320322
- name: PowerShell modules
321323
items:
322-
- name: Modules
324+
- name: Manage modules in Azure Automation
323325
href: shared-resources/modules.md
324-
- name: Using Az modules in Azure Automation
326+
- name: Az module support in Azure Automation
325327
href: az-modules.md
326328
- name: Update Azure PowerShell modules
327329
href: automation-update-azure-modules.md
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
title: Manage Office 365 services using Azure Automation
3+
description: Tells how to use Azure Automation to manage Office 365 subscription services.
4+
services: automation
5+
ms.date: 04/01/2020
6+
ms.topic: conceptual
7+
---
8+
9+
# Manage Office 365 services using Azure Automation
10+
11+
You can use Azure Automation for management of Office 365 subscription services, for products such as Microsoft Word and Microsoft Outlook. Interactions with Office 365 are enabled by [Azure Active Directory (Azure AD)](https://docs.microsoft.com/azure/active-directory/fundamentals/active-directory-whatis). See [Use Azure AD in Azure Automation to authenticate to Azure](automation-use-azure-ad.md).
12+
13+
>[!NOTE]
14+
>This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see [Introducing the new Azure PowerShell Az module](https://docs.microsoft.com/powershell/azure/new-azureps-module-az?view=azps-3.5.0). For Az module installation instructions on your Hybrid Runbook Worker, see [Install the Azure PowerShell Module](https://docs.microsoft.com/powershell/azure/install-az-ps?view=azps-3.5.0). For your Automation account, you can update your modules to the latest version using [How to update Azure PowerShell modules in Azure Automation](automation-update-azure-modules.md).
15+
16+
## Prerequisites
17+
18+
You need the following to manage Office 365 subscription services in Azure Automation.
19+
20+
* An Azure subscription. See [Subscription decision guide](https://docs.microsoft.com/azure/cloud-adoption-framework/decision-guides/subscriptions/).
21+
* An Automation object in Azure to hold the user account credentials and runbooks. See [An introduction to Azure Automation](https://docs.microsoft.com/azure/automation/automation-intro).
22+
* Azure AD. See [Use Azure AD in Azure Automation to authenticate to Azure](automation-use-azure-ad.md).
23+
* An Office 365 tenant, with an account. See [Set up your Office 365 tenant](https://docs.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant).
24+
25+
## Installing the MSOnline and MSOnlineExt modules
26+
27+
Use of Office 365 within Azure Automation requires Microsoft Azure Active Directory for Windows PowerShell (`MSOnline` module). You'll also need the module [`MSOnlineExt`](https://www.powershellgallery.com/packages/MSOnlineExt/1.0.35), which simplifies Azure AD management in single- and multi-tenant environments. Install the modules as described in [Use Azure AD in Azure Automation to authenticate to Azure](automation-use-azure-ad.md).
28+
29+
>[!NOTE]
30+
>To use MSOnline PowerShell, you must be a member of Azure AD. Guest users can't use the module.
31+
32+
## Creating an Azure Automation account
33+
34+
To complete the steps in this article, you need an account in Azure Automation. See [Create an Azure Automation account](automation-quickstart-create-account.md).
35+
36+
## Adding MSOnline and MSOnlineExt as assets
37+
38+
Now add the installed MSOnline and MSOnlineExt modules to enable Office 365 functionality. Refer to [Manage modules in Azure Automation](shared-resources/modules.md).
39+
40+
1. In the Azure portal, select **Automation Accounts**.
41+
2. Choose your Automation account.
42+
3. Select **Modules Gallery** under **Shared Resources**.
43+
4. Search for MSOnline.
44+
5. Select the `MSOnline` PowerShell module and click **Import** to import the module as an asset.
45+
6. Repeat steps 4 and 5 to locate and import the `MSOnlineExt` module.
46+
47+
## Creating a credential asset (optional)
48+
49+
It's optional to create a credential asset for the Office 365 administrative user who has permissions to run your script. It can help, though, to keep from exposing user names and passwords inside PowerShell scripts. For instructions, see [Creating a credential asset](automation-use-azure-ad.md#creating-a-credential-asset).
50+
51+
## Creating an Office 365 service account
52+
53+
To run Office 365 subscription services, you need an Office 365 service account with permissions to do what you want. You can use one global administrator account, one account per service, or have one function or script to execute. In any case, the service account requires a complex and secure password. See [Set up Office 365 for business](https://docs.microsoft.com/microsoft-365/admin/setup/setup?view=o365-worldwide).
54+
55+
## Connecting to the Azure AD online service
56+
57+
>[!NOTE]
58+
>To use the MSOnline module cmdlets, you must run them from Windows PowerShell. PowerShell Core does not support these cmdlets.
59+
60+
You can use the MSOnline module to connect to Azure AD from the Office 365 subscription. The connection uses an Office 365 user name and password or uses multi-factor authentication (MFA). You can connect using the Azure portal or a Windows PowerShell command prompt (does not have to be elevated).
61+
62+
A PowerShell example is shown below. The [Get-Credential](https://docs.microsoft.com/powershell/module/microsoft.powershell.security/get-credential?view=powershell-7) cmdlet prompts for credentials and stores them in the `Msolcred` variable. Then the [Connect-MsolService](https://docs.microsoft.com/powershell/module/msonline/connect-msolservice?view=azureadps-1.0) cmdlet uses the credentials to connect to the Azure directory online service. If you want to connect to a specific Azure environment, use the `AzureEnvironment` parameter.
63+
64+
```powershell
65+
$Msolcred = Get-Credential
66+
Connect-MsolService -Credential $MsolCred -AzureEnvironment "AzureCloud"
67+
```
68+
69+
If you don't receive any errors, you've connected successfully. A quick test is to run an Office 365 cmdlet, for example, `Get-MsolUser`, and see the results. If you receive errors, note that a common problem is an incorrect password.
70+
71+
>[!NOTE]
72+
>You can also use the AzureRM module or the Az module to connect to Azure AD from the Office 365 subscription. The main connection cmdlet is [Connect-AzureAD](https://docs.microsoft.com/powershell/module/azuread/connect-azuread?view=azureadps-2.0). This cmdlet supports the `AzureEnvironmentName` parameter for specific Office 365 environments.
73+
74+
## Creating a PowerShell runbook from an existing script
75+
76+
You access Office 365 functionality from a PowerShell script. Here's an example of a script for a credential named `Office-Credentials` with user name of `[email protected]`. It uses `Get-AutomationPSCredential` to import the Office 365 credential.
77+
78+
```powershell
79+
$emailFromAddress = "[email protected]"
80+
$emailToAddress = "[email protected]"
81+
$emailSMTPServer = "outlook.office365.com"
82+
$emailSubject = "Office 365 License Report"
83+
84+
$credObject = Get-AutomationPSCredential -Name "Office-Credentials"
85+
Connect-MsolService -Credential $credObject
86+
87+
$O365Licenses = Get-MsolAccountSku | Out-String
88+
Send-MailMessage -Credential $credObject -From $emailFromAddress -To $emailToAddress -Subject $emailSubject -Body
89+
90+
$O365Licenses -SmtpServer $emailSMTPServer -UseSSL
91+
```
92+
93+
## Running the script in a runbook
94+
95+
You can use your script in an Azure Automation runbook. For example purposes, we'll use the PowerShell runbook type.
96+
97+
1. Create a new PowerShell runbook. Refer to [Create an Azure Automation runbook](https://docs.microsoft.com/azure/automation/automation-quickstart-create-runbook).
98+
2. From your Automation account, select **Runbooks** under **Process Automation**.
99+
3. Select the new runbook and click **Edit**.
100+
4. Copy your script and paste it into the textual editor for the runbook.
101+
5. Select **ASSETS**, then expand **Credentials** and verify that the Office 365 credential is there.
102+
6. Click **Save**.
103+
7. Select **Test pane**, then click **Start** to begin testing your runbook. See [Manage runbooks in Azure Automation](https://docs.microsoft.com/azure/automation/manage-runbooks).
104+
8. When testing is complete, exit from the Test pane.
105+
106+
## Publishing and scheduling the runbook
107+
108+
To publish and then schedule your runbook, see [Manage runbooks in Azure Automation](https://docs.microsoft.com/azure/automation/manage-runbooks).
109+
110+
## Next steps
111+
112+
* You can find information about Automation credential assets in [Credential assets in Azure Automation](shared-resources/credentials.md).
113+
* See [Manage modules in Azure Automation](shared-resources/modules.md) to find out how to work with Automation modules.
114+
* For an overview of runbook management, see [Manage runbooks in Azure Automation](https://docs.microsoft.com/azure/automation/manage-runbooks).
115+
* To learn more about the methods that can be used to start a runbook in Azure Automation, see [Starting a runbook in Azure Automation](automation-starting-a-runbook.md).
116+
* For more information about PowerShell, including language reference and learning modules, see the [PowerShell Docs](https://docs.microsoft.com/powershell/scripting/overview).

articles/automation/automation-secure-asset-encryption.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Encryption of secure assets in automation
3-
description: Azure automation protects secure assets using multiple levels of encryption. By default, the encryption is done using Microsoft-managed keys. Customers can configure their automation accounts to use customer-managed keys for encryption. This article describes the details of both modes of encryption and how you can switch between the two.
2+
title: Encrypt secure assets in Azure Automation
3+
description: Azure Automation protects secure assets using multiple levels of encryption. By default, the encryption is done using Microsoft-managed keys. Customers can configure their automation accounts to use customer-managed keys for encryption. This article describes the details of both modes of encryption and how you can switch between the two.
44
services: automation
55
ms.service: automation
66
ms.subservice: process-automation
@@ -11,12 +11,12 @@ ms.topic: conceptual
1111
manager: kmadnani
1212
---
1313

14-
# Secure assets in Azure Automation
14+
# Encrypt secure assets in Azure Automation
1515

1616
Secure assets in Azure Automation include credentials, certificates, connections, and encrypted variables. These assets are protected in Azure Automation using multiple levels of encryption.
1717
Based on the top-level key used for the encryption, there are two models for encryption:
18-
- Using Microsoft-managed keys
19-
- Using customer-managed keys
18+
- Using Microsoft-managed keys
19+
- Using customer-managed keys
2020

2121
## Microsoft-managed Keys
2222

articles/automation/automation-use-azure-ad.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ You can use the Azure portal to create the credential asset. Do this operation f
9090

9191
### Create the credential asset with Windows PowerShell
9292

93-
To prepare a new credential asset in Windows PowerShell, your script first creates a `PSCredential` object using the assigned username and password. The script then uses this object to create the asset through a call to the [New-AzureAutomationCredential](https://docs.microsoft.com/powershell/module/servicemanagement/azure/new-azureautomationcredential?view=azuresmps-4.0.0) cmdlet. Alternatively, the script can call the [Get-Credential](https://docs.microsoft.com/powershell/module/microsoft.powershell.security/get-credential?view=powershell-7) cmdlet to prompt the user to type in a name and password. See [Credential assets in Azure Automation](shared-resources/credentials.md).
93+
To prepare a new credential asset in Windows PowerShell, your script first creates a `PSCredential` object using the assigned user name and password. The script then uses this object to create the asset through a call to the [New-AzureAutomationCredential](https://docs.microsoft.com/powershell/module/servicemanagement/azure/new-azureautomationcredential?view=azuresmps-4.0.0) cmdlet. Alternatively, the script can call the [Get-Credential](https://docs.microsoft.com/powershell/module/microsoft.powershell.security/get-credential?view=powershell-7) cmdlet to prompt the user to type in a name and password. See [Credential assets in Azure Automation](shared-resources/credentials.md).
9494

9595
## Managing Azure resources from an Azure Automation runbook
9696

articles/automation/az-modules.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Using Az modules in Azure Automation
3-
description: This article provides information using Az modules in Azure Automation
2+
title: Az module support in Azure Automation
3+
description: This article provides information about using Az modules in Azure Automation.
44
services: automation
55
ms.subservice: shared-capabilities
66
ms.date: 02/08/2019
@@ -60,7 +60,7 @@ One way to test your runbooks before modifying your runbook to use the new cmdle
6060

6161
## After migration details
6262

63-
After the migration is complete, dont start runbooks using `AzureRM` modules on the account any longer. It's also recommended dont import or update `AzureRM` modules on this account. Starting from this moment, consider this account migrated to `Az`, and operate with `Az` modules only. When a new Automation Account is created the existing `AzureRM` modules will still be installed and the tutorial runbooks will still be authored with `AzureRM` cmdlets. These runbooks should not be run.
63+
After the migration is complete, don't start runbooks using `AzureRM` modules on the account any longer. It's also recommended don't import or update `AzureRM` modules on this account. Starting from this moment, consider this account migrated to `Az`, and operate with `Az` modules only. When a new Automation Account is created the existing `AzureRM` modules will still be installed and the tutorial runbooks will still be authored with `AzureRM` cmdlets. These runbooks should not be run.
6464

6565
## Next steps
6666

articles/automation/manage-runbooks.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ Publish-AzAutomationRunbook -AutomationAccountName $automationAccountName `
123123
-Name $runbookName -ResourceGroupName $RGName
124124
```
125125

126+
### Schedule a runbook in the Azure portal
127+
128+
When your runbook has been published, you can schedule it for operation.
129+
130+
1. Open the runbook in the Azure portal.
131+
2. Select **Schedules** under **Resources**.
132+
3. Select **Add a schedule**.
133+
4. In the Schedule Runbook pane, select **Link a schedule to your runbook**.
134+
5. Choose **Create a new schedule** in the Schedule pane.
135+
6. Enter a name, description, and other parameters in the New schedule pane.
136+
7. Once the schedule is created, highlight it and click **OK**. It should now be linked to your runbook.
137+
8. Look for an email in your mailbox to notify you of the runbook status.
138+
126139
## Next steps
127140

128141
* To learn how you can benefit from the Runbook and PowerShell Module Gallery, see [Runbook and module galleries for Azure Automation](automation-runbook-gallery.md).
14.6 KB
Loading

0 commit comments

Comments
 (0)