You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -20,28 +20,21 @@ You need the following to manage Office 365 subscription services in Azure Autom
20
20
* Microsoft Entra ID. See [Use Microsoft Entra ID in Azure Automation to authenticate to Azure](automation-use-azure-ad.md).
21
21
* An Office 365 tenant, with an account. See [Set up your Office 365 tenant](/sharepoint/dev/spfx/set-up-your-developer-tenant).
22
22
23
-
## Install the MSOnline and MSOnlineExt modules
23
+
## Install Microsoft Graph PowerShell
24
24
25
-
Use of Office 365 within Azure Automation requires Microsoft Entra ID for Windows PowerShell (`MSOnline` module). You'll also need the module [`MSOnlineExt`](https://www.powershellgallery.com/packages/MSOnlineExt/1.0.35), which simplifies Microsoft Entra management in single- and multi-tenant environments. Install the modules as described in [Use Microsoft Entra ID in Azure Automation to authenticate to Azure](automation-use-azure-ad.md).
25
+
Use of Office 365 within Azure Automation requires the Microsoft Graph PowerShell module.
26
+
27
+
```powershell
28
+
Install-Module Microsoft.Graph -Scope CurrentUser
29
+
```
26
30
27
31
>[!NOTE]
28
-
>To use MSOnline PowerShell, you must be a member of Microsoft Entra ID. Guest users can't use the module.
32
+
>To use Microsoft Graph PowerShell, you must be a member of Microsoft Entra ID. Guest users can't use the module.
29
33
30
34
## Create an Azure Automation account
31
35
32
36
To complete the steps in this article, you need an account in Azure Automation. See [Create an Azure Automation account](./quickstarts/create-azure-automation-account-portal.md).
33
37
34
-
## Add MSOnline and MSOnlineExt as assets
35
-
36
-
Now add the installed MSOnline and MSOnlineExt modules to enable Office 365 functionality. Refer to [Manage modules in Azure Automation](shared-resources/modules.md).
37
-
38
-
1. In the Azure portal, select **Automation Accounts**.
39
-
2. Choose your Automation account.
40
-
3. Select **Modules Gallery** under **Shared Resources**.
41
-
4. Search for MSOnline.
42
-
5. Select the `MSOnline` PowerShell module and click **Import** to import the module as an asset.
43
-
6. Repeat steps 4 and 5 to locate and import the `MSOnlineExt` module.
44
-
45
38
## Create a credential asset (optional)
46
39
47
40
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 [Create a credential asset](automation-use-azure-ad.md#create-a-credential-asset).
@@ -55,36 +48,32 @@ To run Office 365 subscription services, you need an Office 365 service account
55
48
## Connect to the Microsoft Entra online service
56
49
57
50
>[!NOTE]
58
-
>To use the MSOnline module cmdlets, you must run them from Windows PowerShell. PowerShell Core does not support these cmdlets.
51
+
>To use the Microsoft Graph PowerShell module cmdlets, you must run them from Windows PowerShell. PowerShell Core does not support these cmdlets.
59
52
60
-
You can use the MSOnline module to connect to Microsoft Entra ID 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).
53
+
You can connect to Microsoft Entra ID 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
54
62
-
A PowerShell example is shown below. The [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential) cmdlet prompts for credentials and stores them in the `Msolcred` variable. Then the [Connect-MsolService](/powershell/module/msonline/connect-msolservice) 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.
55
+
A PowerShell example is shown below. For more information, see [Connect-MgGraph](/powershell/module/microsoft.graph.authentication/connect-mggraph).
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 Microsoft Entra ID from the Office 365 subscription. The main connection cmdlet is [Connect-AzureAD](/powershell/module/azuread/connect-azuread). This cmdlet supports the `AzureEnvironmentName` parameter for specific Office 365 environments.
61
+
If you don't receive any errors, you've connected successfully. A quick test is to run an Office 365 cmdlet, for example, [Get-MgUser](/powershell/module/microsoft.graph.users/get-mguser), and see the results.
73
62
74
63
## Create a PowerShell runbook from an existing script
75
64
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.
65
+
You access Office 365 functionality from a PowerShell script.
0 commit comments