Skip to content

Commit d25c960

Browse files
Merge pull request #20 from FriedrichWeinmann/development
1.3.16
2 parents 4a1d5a9 + 48b2147 commit d25c960

5 files changed

+41
-5
lines changed

MiniGraph/MiniGraph.psd1

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
RootModule = 'MiniGraph.psm1'
55

66
# Version number of this module.
7-
ModuleVersion = '1.3.13'
7+
ModuleVersion = '1.3.16'
88

99
# Supported PSEditions
1010
# CompatiblePSEditions = @()
@@ -69,6 +69,7 @@ FunctionsToExport = @(
6969
'Connect-GraphCredential'
7070
'Connect-GraphDeviceCode'
7171
'Connect-GraphToken'
72+
'Get-GraphToken'
7273
'Invoke-GraphRequest'
7374
'Invoke-GraphRequestBatch'
7475
'Set-GraphEndpoint'

MiniGraph/functions/Connect-GraphBrowser.ps1

+4-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
The path to the browser to use for the authentication flow.
4141
Provide the full path to the executable.
4242
The browser must accept the url to open as its only parameter.
43-
Defaults to Edge.
43+
Defaults to your default browser.
4444
4545
.PARAMETER NoReconnect
4646
Disables automatic reconnection.
@@ -74,7 +74,7 @@
7474
$Resource = 'https://graph.microsoft.com/',
7575

7676
[string]
77-
$Browser = $script:browserPath,
77+
$Browser,
7878

7979
[switch]
8080
$NoReconnect
@@ -124,7 +124,8 @@
124124
catch { Invoke-TerminatingException -Cmdlet $PSCmdlet -Message "Failed to create local http listener on port $LocalPort. Use -LocalPort to select a different port. $_" -Category OpenError }
125125

126126
# Execute in default browser
127-
& $Browser $uriFinal
127+
if ($Browser) { & $Browser $uriFinal }
128+
else { Start-Process $uriFinal }
128129

129130
# Get Result
130131
$task = $http.GetContextAsync()
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
function Get-GraphToken {
2+
<#
3+
.SYNOPSIS
4+
Retrieve the currently used graph token.
5+
6+
.DESCRIPTION
7+
Retrieve the currently used graph token.
8+
Use one of the Connect-Graph* commands to first establish a connection.
9+
The token retrieved is a static copy of the current token - it will not be automatically refreshed once expired.
10+
11+
.EXAMPLE
12+
PS C:\> Get-GraphToken
13+
14+
Retrieve the currently used graph token.
15+
#>
16+
[CmdletBinding()]
17+
param (
18+
19+
)
20+
process {
21+
[PSCustomObject]@{
22+
Token = $script:token
23+
Created = $script:lastConnect.When
24+
HasRefresh = $script:lastConnect.Refresh -as [bool]
25+
Endpoint = $script:baseEndpoint
26+
}
27+
}
28+
}

MiniGraph/functions/Invoke-GraphRequestBatch.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
}
190190

191191
try {
192-
(MiniGraph\Invoke-GraphRequestBatch -Name $Name -Request $retry -NoProgress -ErrorAction Stop).responses
192+
(MiniGraph\Invoke-GraphRequestBatch -Request $retry -ErrorAction Stop).responses
193193
}
194194
catch {
195195
Write-Error -Message "Error sending retry batch: $($_.Exception.Message)" -TargetObject $retry

changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.3.16 (2024-03-05)
4+
5+
+ New: Get-GraphToken - retrieve the currently used token
6+
+ Upd: Connect-GraphBrowser - opens logon screen in the default browser by default
7+
+ Fix: Invoke-GraphRequestBatch - retries stop failing
8+
39
## 1.3.13 (2023-12-03)
410

511
+ Upd: Invoke-GraphRequestBatch - simplified requests specification

0 commit comments

Comments
 (0)