Skip to content

Commit 52955f5

Browse files
authored
Merge pull request #1686 from microsoftgraph/dev
Sync Main with Dev
2 parents 15339fb + 6e95ba8 commit 52955f5

File tree

3,486 files changed

+303843
-312360
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,486 files changed

+303843
-312360
lines changed

README.md

Lines changed: 61 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,88 @@
1-
# Microsoft Graph PowerShell SDK
1+
# Microsoft Graph PowerShell Module
22

3-
The Microsoft Graph PowerShell SDK is a collection of PowerShell modules that contain commands for calling Microsoft Graph service.
3+
Consume [Microsoft Graph](https://developer.microsoft.com/graph) resources directly from your PowerShell scripts!
4+
5+
The Microsoft Graph PowerShell Module consists of a collection of PowerShell modules that contain commands for calling Microsoft Graph API. The module acts as an API wrapper for the Microsoft Graph APIs, exposing the entire API set for use in PowerShell.
46

57
## Modules
68

7-
The table below contains our Microsoft Graph rollup module. This module installs all the service modules as its dependencies.
9+
The table below contains a link to our latest Microsoft Graph meta module. This module installs all the service modules as their dependencies.
810
Description | Module Name | PowerShell Gallery Link
911
----------------- | ----------------- | ------------------------
1012
Microsoft Graph | `Microsoft.Graph` | [![Mg]][MgGallery]
1113

12-
For a list of modules found in this repository, see the [Microsoft Graph PowerShell modules](https://github.com/microsoftgraph/msgraph-sdk-powershell/wiki/MS-Graph-PowerShell-Modules) document.
14+
See [Microsoft Graph PowerShell modules](https://github.com/microsoftgraph/msgraph-sdk-powershell/wiki/MS-Graph-PowerShell-Modules) for a list of all modules found in this repository, .
1315

1416
## Installation
1517

1618
### PowerShell Gallery
1719

18-
All the modules are published on [PowerShell Gallery](https://www.powershellgallery.com/packages/Microsoft.Graph). Installing is as simple as:
20+
Microsoft Graph PowerShell module is published on [PowerShell Gallery](https://www.powershellgallery.com/packages/Microsoft.Graph). Installing is as simple as:
1921

2022
``` powershell
2123
Install-Module Microsoft.Graph
2224
```
2325

24-
If you are upgrading from our preview modules, run `Install-Module` with AllowClobber and Force parameters to avoid command name conflicts:
25-
26-
``` powershell
27-
Install-Module Microsoft.Graph -AllowClobber -Force
28-
```
29-
30-
There is a set of samples in the `samples` folder to help in getting started with the library. If you have an older version of these modules installed, there are extra uninstall instructions in the [InstallModule](./samples/0-InstallModule.ps1) script.
26+
> If you are upgrading from our preview modules, run `Install-Module` with AllowClobber and Force parameters to avoid command name conflicts:
27+
>
28+
>``` powershell
29+
> Install-Module Microsoft.Graph -AllowClobber -Force
30+
>```
3131
32+
See [Install the Microsoft Graph PowerShell Module](https://learn.microsoft.com/powershell/microsoftgraph/installation) for detailed installation instructions.
3233
## Usage
3334
34-
1. Authentication
35-
36-
The SDK supports two types of authentication: delegated access and app-only access.
37-
- Delegated access.
38-
39-
``` powershell
40-
# Using interactive authentication.
41-
Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All"
42-
```
35+
### 1. Authentication
4336
44-
or
37+
The module supports two types of authentication models:
4538
46-
``` powershell
47-
# Using device code flow.
48-
Connect-MgGraph -Scopes "User.Read.All", "Group.ReadWrite.All" -UseDeviceAuthentication
49-
```
39+
#### Delegated access
5040
51-
or
41+
Get access to Microsoft Graph resources on behalf of a user.
5242
53-
``` powershell
54-
# Using your own access token.
55-
Connect-MgGraph -AccessToken $AccessToken
56-
```
57-
58-
- App-only access via Client Credential with a certificate.
59-
60-
The certificate will be loaded from `Cert:\CurrentUser\My\` store when `-CertificateThumbprint` or `-CertificateName` is specified. Ensure the certificate is present in the store before calling `Connect-MgGraph`.
43+
``` powershell
44+
# Using interactive authentication.
45+
Connect-MgGraph -Scopes "User.ReadBasic.All", "Application.ReadWrite.All"
46+
```
6147
62-
``` powershell
63-
# Using -CertificateThumbprint
64-
Connect-MgGraph -ClientId "YOUR_APP_ID" -TenantId "YOUR_TENANT_ID" -CertificateThumbprint "YOUR_CERT_THUMBPRINT"
65-
```
48+
#### App-only access (client credentials grant flow)
6649

67-
or
50+
Get access to Microsoft Graph resources using the identity on an app and not on behalf of a user.
6851

69-
``` powershell
70-
# Using -CertificateName
71-
Connect-MgGraph -ClientId "YOUR_APP_ID" -TenantId "YOUR_TENANT_ID" -CertificateName "YOUR_CERT_SUBJECT"
72-
```
52+
``` powershell
53+
# Using -CertificateThumbprint
54+
Connect-MgGraph -ClientId "YOUR_APP_ID" -TenantId "YOUR_TENANT_ID" -CertificateThumbprint "YOUR_CERT_THUMBPRINT"
55+
```
7356

74-
or
57+
> The certificate will be loaded from `Cert:\CurrentUser\My\` store when `-CertificateThumbprint` or `-CertificateName` is specified. Ensure the certificate is present in the store before calling `Connect-MgGraph`.
7558
76-
``` powershell
77-
# Using -Certificate
78-
$Cert = Get-ChildItem Cert:\LocalMachine\My\$CertThumbprint
79-
Connect-MgGraph -ClientId "YOUR_APP_ID" -TenantId "YOUR_TENANT_ID" -Certificate $Cert
80-
```
59+
See [Authentication module cmdlets in Microsoft Graph PowerShell](https://learn.microsoft.com/powershell/microsoftgraph/authentication-commands) for more information.
8160

82-
2. List users in your tenant.
61+
### 2. List users in your tenant
8362

84-
``` powershell
85-
Get-MgUser -Top 10 -Property Id, DisplayName, BusinessPhones | Format-Table Id, DisplayName, BusinessPhones
86-
```
63+
``` powershell
64+
Get-MgUser -Top 10 -Property Id, DisplayName, BusinessPhones | Format-Table Id, DisplayName, BusinessPhones
65+
```
8766

88-
3. Filter a user in your tenant.
67+
### 3. Filter a user in your tenant
8968

90-
``` powershell
91-
$user = Get-MgUser -Filter "displayName eq 'Megan Bowen'"
92-
```
69+
``` powershell
70+
$User = Get-MgUser -Filter "displayName eq 'Megan Bowen'"
71+
```
9372

94-
4. Create a new app registration.
73+
### 4. Create a new app registration
9574

96-
``` powershell
97-
New-MgApplication -DisplayName "ScriptedGraphPSApp" `
98-
-SignInAudience "AzureADMyOrg" `
99-
-Web @{ RedirectUris = "https://localhost"}
100-
```
75+
``` powershell
76+
New-MgApplication -DisplayName "ScriptedGraphPSApp" `
77+
-SignInAudience "AzureADMyOrg" `
78+
-Web @{ RedirectUris = "https://localhost"}
79+
```
10180

102-
5. Sign out of the current logged-in context i.e. app only or delegated access.
81+
### 5. Sign out of the current logged-in context i.e. app only or delegated access
10382

104-
``` powershell
105-
Disconnect-MgGraph
106-
```
83+
``` powershell
84+
Disconnect-MgGraph
85+
```
10786

10887
## API Version
10988

@@ -113,6 +92,20 @@ By default, the SDK uses the Microsoft Graph REST API v1.0. You can change this
11392
Select-MgProfile -Name "beta"
11493
```
11594

95+
## Notes
96+
97+
### Upgrading to v2
98+
99+
The following breaking changes have been introduced between `v1.x` and `v2.x`:
100+
101+
- Dropped profile support.
102+
- Dropped support for `-ForceRefresh` on `Connect-MgGraph`.
103+
- Renamed `beta` command names from `<Verb>-Mg<Noun>` to `<Verb>-MgBeta<Noun>`.
104+
- Changed beta namespace from `Microsoft.Graph.PowerShell.Models.<Entity>` to `Microsoft.Graph.Beta.PowerShell.Models.<Entity>`.
105+
- Changed `-AccessToken` type on `Connect-MgGraph` from `String` to `SecureString`.
106+
107+
See [v2 upgrade guide](https://github.com/microsoftgraph/msgraph-sdk-powershell/blob/features/2.0/docs/upgrade-to-v2.md) for more details.
108+
116109
## Troubleshooting Permission Related Errors
117110

118111
When working with various operations in the Graph, you may encounter an error such as "Insufficient privileges to complete the operation." For example, this particular error can occur when using the `New-MgApplication` command if the appropriate permissions are not granted.

config/ModuleMetadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
],
2626
"releaseNotes": "See https://aka.ms/GraphPowerShell-Release.",
2727
"assemblyOriginatorKeyFile": "35MSSharedLib1024.snk",
28-
"version": "1.17.0"
28+
"version": "1.19.0"
2929
}

0 commit comments

Comments
 (0)