Skip to content

Commit

Permalink
1.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
NickolajA committed Sep 3, 2022
1 parent 8f5c111 commit 644deff
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion IntuneWin32App.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
RootModule = 'IntuneWin32App.psm1'

# Version number of this module.
ModuleVersion = '1.3.4'
ModuleVersion = '1.3.5'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
11 changes: 10 additions & 1 deletion Private/Invoke-AzureStorageBlobUpload.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ function Invoke-AzureStorageBlobUpload {
Author: Nickolaj Andersen
Contact: @NickolajA
Created: 2020-01-04
Updated: 2021-03-15
Updated: 2022-09-03
Version history:
1.0.0 - (2020-01-04) Function created
1.0.1 - (2020-09-20) Fixed an issue where the System.IO.BinaryReader wouldn't open a file path containing whitespaces
1.0.2 - (2021-03-15) Fixed an issue where SAS Uri renewal wasn't working correctly
1.0.3 - (2022-09-03) Added access token refresh functionality when a token is about to expire, to prevent uploads from failing due to an expire access token
#>
param(
[parameter(Mandatory = $true)]
Expand Down Expand Up @@ -49,6 +50,14 @@ function Invoke-AzureStorageBlobUpload {
for ($Chunk = 0; $Chunk -lt $ChunkCount; $Chunk++) {
Write-Verbose -Message "SAS Uri renewal timer has elapsed for: $($SASRenewalTimer.Elapsed.Minutes) minute $($SASRenewalTimer.Elapsed.Seconds) seconds"

# Refresh access token if about to expire
$UTCDateTime = (Get-Date).ToUniversalTime()
$TokenExpiresMinutes = ($Global:AccessToken.ExpiresOn.DateTime - $UTCDateTime).Minutes
if ($TokenExpiresMinutes -le 10) {
Write-Verbose -Message "Existing token found but is soon about to expire, refreshing token"
Connect-MSIntuneGraph -TenantID $Global:AccessTokenTenantID -Refresh
}

# Convert and calculate required chunk elements for content upload
$ChunkID = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($Chunk.ToString("0000")))
$ChunkIDs += $ChunkID
Expand Down
4 changes: 3 additions & 1 deletion Public/Connect-MSIntuneGraph.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ function Connect-MSIntuneGraph {
Author: Nickolaj Andersen
Contact: @NickolajA
Created: 2021-08-31
Updated: 2022-03-28
Updated: 2022-09-03
Version history:
1.0.0 - (2021-08-31) Script created
1.0.1 - (2022-03-28) Added ClientSecret parameter input to support client secret auth flow
1.0.2 - (2022-09-03) Added new global variable to hold the tenant id passed as parameter input for access token refresh scenario
#>
[CmdletBinding(DefaultParameterSetName = "Interactive")]
param(
Expand Down Expand Up @@ -144,6 +145,7 @@ function Connect-MSIntuneGraph {
try {
# Attempt to retrieve or refresh an access token
$Global:AccessToken = Get-MsalToken @AccessTokenArguments
$Global:AccessTokenTenantID = $TenantID
Write-Verbose -Message "Successfully retrieved access token"

try {
Expand Down
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release notes for IntuneWin32App module

## 1.3.5
- Connect-MSIntuneGraph function has been updated to store the TenantID parameter in a global variable named $Global:AccessTokenTenantID.
- Private function Invoke-AzureStorageBlobUpload used in Add-IntuneWin32App function now refreshes an access token 10 minutes before it's about to expire. This should prevent uploads of large applications from failing due to the access token has expired.

## 1.3.4
- Private function New-IntuneWin32AppBody used in Add-IntuneWin32App function, was updated where the minimumSupportedOperatingSystem property is replaced by minimumSupportedWindowsRelease. This caused the Add-IntuneWin32App function to return Bad Request since the request body was malformed. `NOTE:` This change introduces a new parameter for New-IntuneWin32AppRequirementRule function named MinimumSupportedWindowsRelease that replaces the MinimumSupportedOperatingSystem parameter.
- Also fixed a bug in private function New-IntuneWin32AppBody where minimumFreeDiskSpaceInMB, minimumMemoryInMB, minimumNumberOfProcessors and minimumCpuSpeedInMHz properties where not handled at all.
Expand Down

0 comments on commit 644deff

Please sign in to comment.