Skip to content

Commit cb75e09

Browse files
authored
Merge pull request #2115 from microsoftgraph/po/UpdateReadMeDocs
Update Readme and Samples
2 parents 281406d + 55ae17b commit cb75e09

File tree

5 files changed

+33
-37
lines changed

5 files changed

+33
-37
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ The Microsoft Graph PowerShell module consists of a collection of PowerShell mod
2727
## Modules
2828

2929
The table below contains links to our latest and preview versions of the Microsoft Graph module. The meta modules will install all the service modules as their dependencies.
30-
| Module | Latest | Preview |
31-
| --------------------------------------- | ------------------ | ------------------------------ |
32-
| [`Microsoft.Graph`][mggallery] | [![mg]][mggallery] | [![mgnext]][mggallery] |
33-
| [`Microsoft.Graph.Beta`][mggallerybeta] | - | [![mgbetaNext]][mggallerybeta] |
30+
| Module | Latest | Preview |
31+
| --------------------------------------- | ---------------------------- | ------------------------------ |
32+
| [`Microsoft.Graph`][mggallery] | [![mg]][mggallery] | - |
33+
| [`Microsoft.Graph.Beta`][mggallerybeta] | [![mgbeta]][mggallerybeta] | - |
3434

3535
See [Microsoft Graph PowerShell modules](https://github.com/microsoftgraph/msgraph-sdk-powershell/wiki/MS-Graph-PowerShell-Modules) for a list of all modules supported by this repository.
3636

@@ -41,13 +41,13 @@ See [Microsoft Graph PowerShell modules](https://github.com/microsoftgraph/msgra
4141
Microsoft Graph PowerShell module is published on [PowerShell Gallery](https://www.powershellgallery.com/packages/Microsoft.Graph). Installing is as simple as:
4242

4343
```powershell
44-
Install-Module Microsoft.Graph -AllowPrerelease
44+
Install-Module Microsoft.Graph
4545
```
4646

4747
> Run `Install-Module` with AllowClobber and Force parameters if you run into command name conflicts when upgrading to older versions of the module:
4848
>
4949
> ```powershell
50-
> Install-Module Microsoft.Graph -AllowPrerelease -AllowClobber -Force
50+
> Install-Module Microsoft.Graph -AllowClobber -Force
5151
> ```
5252
5353
See [Install the Microsoft Graph PowerShell Module](https://learn.microsoft.com/powershell/microsoftgraph/installation) guide for detailed installation instructions.
@@ -74,7 +74,7 @@ Get access to Microsoft Graph resources using the identity on an app and not on
7474
Connect-MgGraph -ClientId "YOUR_APP_ID" -TenantId "YOUR_TENANT_ID" -CertificateThumbprint "YOUR_CERT_THUMBPRINT"
7575
```
7676

77-
See [Authentication](./docs/authentication.md) for more information on usage of `Connect-MgGraph`.
77+
See [Authentication](./docs/authentication.md) for more information on the usage of `Connect-MgGraph`.
7878

7979
### 3. List users in your tenant
8080

@@ -107,7 +107,7 @@ Disconnect-MgGraph
107107
Install `Microsoft.Graph.Beta` module to commands that call Microsoft Graph Beta API endpoint.
108108

109109
```powershell
110-
Install-Module Microsoft.Graph.Beta -AllowPrerelease
110+
Install-Module Microsoft.Graph.Beta
111111
# Consume Microsoft Graph beta resources.
112112
Connect-MgGraph
113113
$Users = Get-MgBetaUser
@@ -133,19 +133,19 @@ See [v2 upgrade guide](https://github.com/microsoftgraph/msgraph-sdk-powershell/
133133

134134
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.
135135

136-
If permission-related errors occur and the signed in user/app has been granted the appropriate permissions to perform the operation, you can explicitly fetch a new access token by running `Disconnect-MgGraph`, then `Connect-MgGraph`. This will trigger a refresh of the access token in your cache. Microsoft Authentication Library (MSAL) will only refresh access tokens in your cache if they have expired (usually an hour).
136+
If permission-related errors occur and the signed-in user/app has been granted the appropriate permissions to perform the operation, you can explicitly fetch a new access token by running `Disconnect-MgGraph`, then `Connect-MgGraph`. This will trigger a refresh of the access token in your cache. Microsoft Authentication Library (MSAL) will only refresh access tokens in your cache if they have expired (usually an hour).
137137

138138
### Common Errors
139139

140-
See our [troubleshooting guide](https://learn.microsoft.com/powershell/microsoftgraph/troubleshooting) for detailed view on how to troubleshoot common errors when using Microsoft Graph.
140+
See our [troubleshooting guide](https://learn.microsoft.com/powershell/microsoftgraph/troubleshooting) for a detailed view of how to troubleshoot common errors when using Microsoft Graph.
141141

142142
## Known Issues
143143

144144
- Using `-Property {PropertyName}` parameter will not select the property as the output of the command. All commands return CLR objects, and customers should pipe the command outputs to `Format-Table` or `Select-Object` to return individual properties.
145145

146146
- Customers upgrading from previous versions of the SDK may encounter auth prompts on every command call. If this happens, one can use the following steps to reset their token cache:
147147
- Use `Disconnect-MgGraph` to sign out of the current session.
148-
- Run `Remove-Item "$env:USERPROFILE\.graph" -Recurse -Force` to delete your token cache.
148+
- Run `Remove-Item "$env:USERPROFILE\.mg" -Recurse -Force` to delete your token cache.
149149
- Run `Connect-MgGraph` to reconstruct a clean token cache.
150150

151151
## Feedback
@@ -163,6 +163,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT
163163
<!-- Shields -->
164164

165165
[mg]: https://img.shields.io/powershellgallery/v/Microsoft.Graph.svg?style=flat-square&label=Microsoft.Graph
166+
[mgbeta]: https://img.shields.io/powershellgallery/v/Microsoft.Graph.Beta.svg?style=flat-square&label=Microsoft.Graph.Beta
166167
[mgnext]: https://img.shields.io/powershellgallery/v/Microsoft.Graph.svg?include_prereleases&style=flat-square&label=Microsoft.Graph
167168
[mgbetanext]: https://img.shields.io/powershellgallery/v/Microsoft.Graph.Beta.svg?include_prereleases&style=flat-square&label=Microsoft.Graph.Beta
168169

samples/5-Teams.ps1

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,67 @@
1-
# Switch to beta profile. This loads cmdlets that call MS Graph beta endpoint.
2-
Select-MgProfile -Name beta
1+
# Install Microsoft.Graph.Beta module. The following samples call the Microsoft Graph beta endpoint.
32

43
# Create a new team.
54
$TeamName = "2020 Interns"
6-
New-MgTeam -DisplayName $TeamName -Description $TeamName `
5+
New-MgBetaTeam -DisplayName $TeamName -Description $TeamName `
76
-AdditionalProperties @{
87
"[email protected]" = "https://graph.microsoft.com/beta/teamsTemplates('standard')"
98
}
109

1110
# Filter groups by displayName and resourceProvisioningOptions to find team.
12-
$InternsTeam = Get-MgGroup -Filter "StartsWith(DisplayName, '$TeamName')" `
11+
$InternsTeam = Get-MgBetaGroup -Filter "StartsWith(DisplayName, '$TeamName')" `
1312
| Where-Object { $_.ResourceProvisioningOptions -Contains "Team" }
1413

1514
# Add team owner.
16-
$teamOwner = Get-MgUser -UserId "{TEAM_OWNER_UPN}"
17-
New-MgTeamMember -TeamId $InternsTeam.Id -Roles "owner" `
15+
$teamOwner = Get-MgBetaUser -UserId "{TEAM_OWNER_UPN}"
16+
New-MgBetaTeamMember -TeamId $InternsTeam.Id -Roles "owner" `
1817
-AdditionalProperties @{
1918
"@odata.type" = "#microsoft.graph.aadUserConversationMember";
2019
"[email protected]" = "https://graph.microsoft.com/beta/users/" + $teamOwner.Id
2120
}
2221

2322
# Filter users to find users who have a UPN that starts with 't-'.
24-
$TeamMembers = Get-MgUser -Filter "startswith(userPrincipalName, 't-')"
23+
$TeamMembers = Get-MgBetaUser -Filter "startswith(userPrincipalName, 't-')"
2524

2625
# Add team members.
2726
foreach ($teamMember in $TeamMembers) {
28-
New-MgTeamMember -TeamId $InternsTeam.Id -Roles "member" `
27+
New-MgBetaTeamMember -TeamId $InternsTeam.Id -Roles "member" `
2928
-AdditionalProperties @{
3029
"@odata.type" = "#microsoft.graph.aadUserConversationMember";
3130
"[email protected]" = "https://graph.microsoft.com/beta/users/" + $teamMember.Id
3231
}
3332
}
3433

3534
# Send a welcome message to the channel.
36-
$PrimaryChannel = Get-MgTeamPrimaryChannel -TeamId $InternsTeam.Id
37-
New-MgTeamChannelMessage -TeamId $InternsTeam.Id `
35+
$PrimaryChannel = Get-MgBetaTeamPrimaryChannel -TeamId $InternsTeam.Id
36+
New-MgBetaTeamChannelMessage -TeamId $InternsTeam.Id `
3837
-ChannelId $PrimaryChannel.Id `
3938
-Body @{
4039
Content = "Welcome to Teams!"
4140
}
4241

4342
# Delete team.
44-
Remove-MgGroup -GroupId $InternsTeam.Id
43+
Remove-MgBetaGroup -GroupId $InternsTeam.Id
4544

4645
# Teams Chat snippets
4746

4847
# Get list of 1:1 chats
49-
Get-MgChat
48+
Get-MgBetaChat
5049

5150
# Get Messages from Chat
52-
Get-MgChatMessage -chatId $chatId
51+
Get-MgBetaChatMessage -chatId $chatId
5352

5453
# Send a message in that 1:1 chat
55-
New-MgChatMessage -chatId $chatId -Body @{ Content = "Hi from VSCode again!" }
54+
New-MgBetaChatMessage -chatId $chatId -Body @{ Content = "Hi from VSCode again!" }
5655

5756
# Mention a user in a channel message.
58-
$User = Get-MgUser -UserId $userUPN | select id, displayName, userIdentityType
57+
$User = Get-MgBetaUser -UserId $userUPN | select id, displayName, userIdentityType
5958
$UserToMention = @{
6059
Id = $User.Id;
6160
DisplayName = $User.DisplayName;
6261
UserIdentityType = "aadUser";
6362
}
6463

65-
New-MgTeamChannelMessage -ChannelId $ChannelId -TeamId $TeamId `
64+
New-MgBetaTeamChannelMessage -ChannelId $ChannelId -TeamId $TeamId `
6665
-Body @{ `
6766
ContentType = "html"; `
6867
Content = "Welcome to the channel! <at id='0'>$($UserToMention.DisplayName)</at>" `

samples/Scripts/Get-TeamMembers.ps1

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,25 @@ Connect-Graph -ClientId "YOUR_CLIENT_ID" `
55
-TenantId "YOUR_TENANT_ID" `
66
-CertificateName "YOUR_CERTIFICATE_NAME"
77

8-
# Switch to beta profile to use these samples.
9-
Select-MgProfile -Name beta
10-
11-
$groups = Get-MgGroup
8+
# Install beta SDK to use these samples.
9+
$groups = Get-MgBetaGroup
1210
$teams = $groups | Where-Object { $_.ResourceProvisioningOptions -Contains "Team" }
1311

1412
# List owners and memebers of all Teams team in your tenant.
1513
foreach($team in $teams) {
1614
Write-Host "Team: " + $team.DisplayName -ForegroundColor Blue
1715

1816
Write-Host "Owners: " -ForegroundColor Yellow
19-
$owners = Get-MgGroupOwner -GroupId $team.Id
17+
$owners = Get-MgBetaGroupOwner -GroupId $team.Id
2018
foreach($owner in $owners) {
21-
$o = Get-MgUser -UserId $owner.Id
19+
$o = Get-MgBetaUser -UserId $owner.Id
2220
Write-Host $o.DisplayName -ForegroundColor Yellow
2321
}
2422

2523
Write-Host "Members: " -ForegroundColor Green
26-
$members = Get-MgGroupMember -GroupId $team.Id
24+
$members = Get-MgBetaGroupMember -GroupId $team.Id
2725
foreach($member in $members) {
28-
$u = Get-MgUser -UserId $member.Id
26+
$u = Get-MgBetaUser -UserId $member.Id
2927
Write-Host $u.DisplayName -ForegroundColor Green
3028
}
3129
}

src/Users.Actions/v1.0/examples/Set-MgUserLicense.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ This example updates the **EMSPREMIUM** license assigned to the user to add **AA
9595
```powershell
9696
Connect-Graph -Scopes User.ReadWrite.All, Organization.Read.All
9797
98-
Select-MgProfile -Name Beta
9998
$mgUser = Get-MgUser -UserId '38955658-c844-4f59-9430-6519430ac89b'
10099
101100
Set-MgUserLicense -UserId "82f51c98-7221-442f-8329-3faf9fe022f1" -AddLicenses $mgUser.AssignedLicenses -RemoveLicenses @()

tools/Tests/DebugTests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ BeforeAll {
88
Import-Module $TestModulePath -Force
99

1010
Connect-MgGraph
11-
Select-MgProfile beta
1211
}
1312
Describe 'Cmdlets Streams' {
1413
It 'Should Not Throw Exception when Debug Preference is Set'{

0 commit comments

Comments
 (0)