Skip to content

Commit 6de139b

Browse files
Connect-MgGraph Parameter completer
Connect-MgGraph Parameter completer
2 parents d16a581 + 39c694b commit 6de139b

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/Authentication/Authentication/custom/Find-MgGraphPermission.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,4 @@ function Find-MgGraphPermission {
223223

224224
end {
225225
}
226-
}
226+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
# ------------------------------------------------------------------------------
4+
5+
Set-StrictMode -Version 2
6+
7+
. "$psscriptroot/common/Permissions.ps1"
8+
9+
$scopesParameterBlock = {
10+
param($commandName,
11+
$parameterName,
12+
$wordToComplete,
13+
$commandAst,
14+
$fakeBoundParameters
15+
)
16+
17+
$permissions = @()
18+
$permissionsOAuthQuery = Permissions_GetOauthData (Permissions_GetPermissionsData)
19+
$permissions += $permissionsOAuthQuery.Name
20+
$permissions | Where-Object {
21+
$_ -like "$wordToComplete*"
22+
}
23+
}
24+
25+
Register-ArgumentCompleter -CommandName Connect-MgGraph -ParameterName Scopes -ScriptBlock $scopesParameterBlock

0 commit comments

Comments
 (0)