Skip to content

Commit 252bbd2

Browse files
authored
Merge pull request MicrosoftDocs#276 from msewaweru/sdk-v2-doc-updates
Updated the get-started articles as per SDK v2 changes
2 parents 2fe35f8 + e8bc400 commit 252bbd2

File tree

3 files changed

+46
-43
lines changed

3 files changed

+46
-43
lines changed

microsoftgraph/docs-conceptual/authentication-commands.md

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ There are three ways to allow delegated access using `Connect-MgGraph`:
3939
Connect-MgGraph -AccessToken $AccessToken
4040
```
4141
42-
### App-only access via client credential with a certificate
42+
### App-only access
4343
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).
4547
4648
- Using Certificate Thumbprint:
4749
@@ -64,6 +66,36 @@ To use app-only access, the certificate is loaded from *Cert:\CurrentUser\My\\*
6466
6567
To use a certificate stored in your machine's certificate store or another ___location when connecting to Microsoft Graph, specify the certificate's ___location.
6668
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.
72+
73+
```powershell
74+
$ClientSecretCredential = Get-Credential -Username "Client_Id"
75+
# Enter client_secret in the password prompt.
76+
Connect-MgGraph -TenantId "Tenant_Id" -ClientSecretCredential $ClientSecretCredential
77+
```
78+
79+
#### Using managed identity
80+
81+
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.
94+
95+
```powershell
96+
Connect-MgGraph -Identity -ClientId "User_Assigned_Managed_identity_Client_Id"
97+
```
98+
6799
### Connecting to an environment or cloud
68100
69101
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
196228
User.ReadWrite.All
197229
```
198230

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-
227231
## Using Invoke-MgGraphRequest
228232

229233
`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.

microsoftgraph/docs-conceptual/get-started.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
title: "Get started with the Microsoft Graph PowerShell SDK"
33
description: "Get started with the Microsoft Graph PowerShell SDK by using it perform some basic tasks."
44

5-
author: jasonjoh
5+
author: msewaweru
66
manager: CelesteDG
77
ms.topic: quickstart
8-
ms.date: 04/25/2023
9-
ms.author: jasonjoh
8+
ms.date: 05/17/2023
9+
ms.author: eunicewaweru
1010
---
1111

1212
# 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
1515

1616
## API version
1717

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.
2319

2420
## Authentication
2521

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.
2723

2824
For details on using app-only access for unattended scenarios, see [Use app-only authentication with the Microsoft Graph PowerShell SDK](app-only.md).
2925

@@ -68,7 +64,7 @@ Use the `Connect-MgGraph` command to sign in with the required scopes. You'll ne
6864
Connect-MgGraph -Scopes "User.Read.All","Group.ReadWrite.All"
6965
```
7066

71-
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.
7268

7369
> [!TIP]
7470
> You can add additional permissions by repeating the `Connect-MgGraph` command with the new permission scopes.

microsoftgraph/docs-conceptual/navigating.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
title: "Navigating the Microsoft Graph PowerShell SDK"
33
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."
44

5-
author: jasonjoh
5+
author: msewaweru
66
manager: CelesteDG
77
ms.topic: conceptual
8-
ms.date: 04/25/2023
9-
ms.author: jasonjoh
8+
ms.date: 05/17/2023
9+
ms.author: eunicewaweru
1010
---
1111

1212
# Navigating the Microsoft Graph PowerShell SDK
@@ -37,6 +37,9 @@ For functions and actions, it's a little more complicated. APIs in Microsoft Gra
3737

3838
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`.
3939

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+
4043
### Command nouns
4144

4245
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

Comments
 (0)