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
Copy file name to clipboardExpand all lines: microsoftgraph/docs-conceptual/authentication-commands.md
+34-30Lines changed: 34 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,9 +39,11 @@ There are three ways to allow delegated access using `Connect-MgGraph`:
39
39
Connect-MgGraph -AccessToken $AccessToken
40
40
```
41
41
42
-
### App-only access via client credential with a certificate
42
+
### App-only access
43
43
44
-
To use app-only access, the certificate is loaded from *Cert:\CurrentUser\My\\* when `-CertificateThumbprint` or `-CertificateName` is specified. Make sure that the certificate you're using is present in the store before calling `Connect-MgGraph`. For more info, see [Use app-only authentication with the Microsoft Graph PowerShell SDK](app-only.md).
44
+
#### Using client credential with a certificate
45
+
46
+
To use app-only access, the certificate is loaded from either *Cert:\CurrentUser\My\\* or *Cert:\LocalMachine\My\\* when `-CertificateThumbprint` or `-CertificateName` is specified. Make sure that the certificate you're using is present in either certificate store before calling `Connect-MgGraph`. For more info, see [Use app-only authentication with the Microsoft Graph PowerShell SDK](app-only.md).
45
47
46
48
- Using Certificate Thumbprint:
47
49
@@ -64,6 +66,36 @@ To use app-only access, the certificate is loaded from *Cert:\CurrentUser\My\\*
64
66
65
67
To use a certificate stored in your machine's certificate store or another ___location when connecting to Microsoft Graph, specify the certificate's ___location.
66
68
69
+
#### Using client secret credentials
70
+
71
+
If you need interactions in the background, without a user to sign in, this type of grant will help you. Support for client secret credentials was added by adding **-ClientSecretCredential** parameter to **Connect-MgGraph**. See [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential) on how to get or create credentials.
A common challenge when writing automation scripts is the management of secrets, credentials, certificates, and keys used to secure communication between services. Eliminate the need to manage credentials by allowing the module to obtain access tokens for Azure resources that are protected by Azure AD. The identity is managed by the Azure platform and does not require you to provision or rotate any secrets.
82
+
83
+
- System-assigned managed identity:
84
+
85
+
Uses an automatically managed identity on a service instance. The identity is tied to the lifecycle of a service instance.
86
+
87
+
```powershell
88
+
Connect-MgGraph -Identity
89
+
```
90
+
91
+
- User-assigned managed identity:
92
+
93
+
Uses a user created managed identity as a standalone Azure resource.
By default, `Connect-MgGraph` targets the global public cloud. To target other clouds, see [Using Get-MgEnvironment](#using-get-mgenvironment).
@@ -196,34 +228,6 @@ User.Read
196
228
User.ReadWrite.All
197
229
```
198
230
199
-
## Using Get-MgProfile
200
-
201
-
By default the Microsoft Graph PowerShell commands target the v1.0 API version. Commands for APIs that are only available in beta aren't available in PowerShell by default.
202
-
203
-
To check your current profile, run:
204
-
205
-
```powershell
206
-
Get-MgProfile
207
-
```
208
-
209
-
```Output
210
-
Name Description
211
-
---- -----------
212
-
v1.0 A snapshot of the Microsoft Graph v1.0 API for the Global cloud.
213
-
```
214
-
215
-
## Using Select-MgProfile
216
-
217
-
Use `Select-MgProfile` to change your target API version.
218
-
219
-
To change to the beta version, run:
220
-
221
-
```powershell
222
-
Select-MgProfile -Name Beta
223
-
```
224
-
225
-
To switch back to using v1.0 API commands, specify **v1.0** for the name parameter.
226
-
227
231
## Using Invoke-MgGraphRequest
228
232
229
233
`Invoke-MgGraphRequest` issues REST API requests to the Graph API. It works for any Graph API if you know the REST URI, method and optional body parameter. This command is especially useful for accessing APIs for which there isn't an equivalent cmdlet yet.
Copy file name to clipboardExpand all lines: microsoftgraph/docs-conceptual/get-started.md
+6-10Lines changed: 6 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
title: "Get started with the Microsoft Graph PowerShell SDK"
3
3
description: "Get started with the Microsoft Graph PowerShell SDK by using it perform some basic tasks."
4
4
5
-
author: jasonjoh
5
+
author: msewaweru
6
6
manager: CelesteDG
7
7
ms.topic: quickstart
8
-
ms.date: 04/25/2023
9
-
ms.author: jasonjoh
8
+
ms.date: 05/17/2023
9
+
ms.author: eunicewaweru
10
10
---
11
11
12
12
# Get started with the Microsoft Graph PowerShell SDK
@@ -15,15 +15,11 @@ In this guide, you'll use the Microsoft Graph PowerShell SDK to perform some bas
15
15
16
16
## API version
17
17
18
-
By default, the SDK uses the [Microsoft Graph REST API v1.0](/graph/api/overview?view=graph-rest-1.0&preserve-view=true). Cmdlets are available for the API version that is selected. You can change the profile by using the `Select-MgProfile` command.
19
-
20
-
```powershell
21
-
Select-MgProfile -Name "beta"
22
-
```
18
+
The SDK contains 2 modules, Microsoft.Graph and Microsoft.Graph.Beta, that call the [Microsoft Graph REST API v1.0](/graph/api/overview?view=graph-rest-1.0&preserve-view=true) and [Microsoft Graph REST API beta](/graph/api/overview?view=graph-rest-beta&preserve-view=true), respectively. Cmdlets are available for the module that is installed.
23
19
24
20
## Authentication
25
21
26
-
The PowerShell SDK supports two types of authentication: delegated access, and app-only access. In this guide, you'll use delegated access to sign in as a user, grant consent to the SDK to act on your behalf, and call the Microsoft Graph.
22
+
The PowerShell SDK supports two types of authentication: *delegated access*, and *app-only access*. In this guide, you'll use delegated access to sign in as a user, grant consent to the SDK to act on your behalf, and call the Microsoft Graph.
27
23
28
24
For details on using app-only access for unattended scenarios, see [Use app-only authentication with the Microsoft Graph PowerShell SDK](app-only.md).
29
25
@@ -68,7 +64,7 @@ Use the `Connect-MgGraph` command to sign in with the required scopes. You'll ne
The command prompts you to go to a web page to sign in using a device code. Once you've done that, the command indicates success with a `Welcome To Microsoft Graph!` message. You only need to sign in once per session.
67
+
The command prompts you to go to a web page to sign in with your credentials. Once you've done that, the command indicates success with a `Welcome To Microsoft Graph!` message. You only need to sign in once per session.
72
68
73
69
> [!TIP]
74
70
> You can add additional permissions by repeating the `Connect-MgGraph` command with the new permission scopes.
Copy file name to clipboardExpand all lines: microsoftgraph/docs-conceptual/navigating.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
title: "Navigating the Microsoft Graph PowerShell SDK"
3
3
description: "The Microsoft Graph PowerShell SDK contains a large number of commands. Learn how to find the right command for what you want to achieve."
4
4
5
-
author: jasonjoh
5
+
author: msewaweru
6
6
manager: CelesteDG
7
7
ms.topic: conceptual
8
-
ms.date: 04/25/2023
9
-
ms.author: jasonjoh
8
+
ms.date: 05/17/2023
9
+
ms.author: eunicewaweru
10
10
---
11
11
12
12
# Navigating the Microsoft Graph PowerShell SDK
@@ -37,6 +37,9 @@ For functions and actions, it's a little more complicated. APIs in Microsoft Gra
37
37
38
38
Let's look at some examples. The [getSchedule](/graph/api/calendar-getschedule?view=graph-rest-1.0&preserve-view=true) API uses `get`, and `Get` is an approved PowerShell verb, so its command is `Get-MgUserCalendarSchedule`. The [cancel](/graph/api/event-cancel?view=graph-rest-beta&preserve-view=true) API on an event on the other hand, uses a non-approved verb `cancel`. The approved verb for canceling or discontinuing something is `Stop`, so the command is `Stop-MgUserEvent`. Finally, the [snoozeReminder](/graph/api/event-snoozereminder?view=graph-rest-1.0&preserve-view=true) API's verb, `snooze`, has no PowerShell-approved equivalent. For APIs like that, the SDK uses the verb `Invoke`, so that API's command is `Invoke-MgSnoozeUserEventReminder`.
39
39
40
+
> [!NOTE]
41
+
> For Beta cmdlets add a **Beta** prefix before the resource. For example, the beta version of the Get-MgUser cmdlet is **Get-MgBetaUser**.
42
+
40
43
### Command nouns
41
44
42
45
By now you may have noticed that all nouns in the SDK's commands start with `Mg`. This prefix helps to avoid naming conflicts with other PowerShell modules. With that in mind, it should make sense that a command like `Get-MgUser` is used to get a user. Following PowerShell convention, even though the noun is singular, those same commands can return multiple results if no specific instance is requested.
0 commit comments