Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.3.16 #20

Merged
merged 3 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MiniGraph/MiniGraph.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RootModule = 'MiniGraph.psm1'

# Version number of this module.
ModuleVersion = '1.3.13'
ModuleVersion = '1.3.16'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -69,6 +69,7 @@ FunctionsToExport = @(
'Connect-GraphCredential'
'Connect-GraphDeviceCode'
'Connect-GraphToken'
'Get-GraphToken'
'Invoke-GraphRequest'
'Invoke-GraphRequestBatch'
'Set-GraphEndpoint'
Expand Down
7 changes: 4 additions & 3 deletions MiniGraph/functions/Connect-GraphBrowser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
The path to the browser to use for the authentication flow.
Provide the full path to the executable.
The browser must accept the url to open as its only parameter.
Defaults to Edge.
Defaults to your default browser.

.PARAMETER NoReconnect
Disables automatic reconnection.
Expand Down Expand Up @@ -74,7 +74,7 @@
$Resource = 'https://graph.microsoft.com/',

[string]
$Browser = $script:browserPath,
$Browser,

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

# Execute in default browser
& $Browser $uriFinal
if ($Browser) { & $Browser $uriFinal }
else { Start-Process $uriFinal }

# Get Result
$task = $http.GetContextAsync()
Expand Down
28 changes: 28 additions & 0 deletions MiniGraph/functions/Get-GraphToken.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
function Get-GraphToken {
<#
.SYNOPSIS
Retrieve the currently used graph token.

.DESCRIPTION
Retrieve the currently used graph token.
Use one of the Connect-Graph* commands to first establish a connection.
The token retrieved is a static copy of the current token - it will not be automatically refreshed once expired.

.EXAMPLE
PS C:\> Get-GraphToken

Retrieve the currently used graph token.
#>
[CmdletBinding()]
param (

)
process {
[PSCustomObject]@{
Token = $script:token
Created = $script:lastConnect.When
HasRefresh = $script:lastConnect.Refresh -as [bool]
Endpoint = $script:baseEndpoint
}
}
}
2 changes: 1 addition & 1 deletion MiniGraph/functions/Invoke-GraphRequestBatch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
}

try {
(MiniGraph\Invoke-GraphRequestBatch -Name $Name -Request $retry -NoProgress -ErrorAction Stop).responses
(MiniGraph\Invoke-GraphRequestBatch -Request $retry -ErrorAction Stop).responses
}
catch {
Write-Error -Message "Error sending retry batch: $($_.Exception.Message)" -TargetObject $retry
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.3.16 (2024-03-05)

+ New: Get-GraphToken - retrieve the currently used token
+ Upd: Connect-GraphBrowser - opens logon screen in the default browser by default
+ Fix: Invoke-GraphRequestBatch - retries stop failing

## 1.3.13 (2023-12-03)

+ Upd: Invoke-GraphRequestBatch - simplified requests specification
Expand Down