This repository of PowerShell sample scripts show how to access Intune service resources. They demonstrate this by making HTTPS RESTful API requests to the Microsoft Graph API from PowerShell.
MIT License
1.36k
stars
658
forks
source link
Issues with PowerShell 7 (Application_LOB_Add.ps1) #275
Most of these scripts were initially built with PowerShell 5 and do not work with PowerShell 7 as-is.
If you find yourself working through this, two key changes you need to make:
1) Fix the header in UploadAzureStorageChunk to specify the content type as follows:
$headers = @{
"x-ms-blob-type" = "BlockBlob"
"Content-Type" = "text/plain; charset=iso-8859-1"
};
Most of these scripts were initially built with PowerShell 5 and do not work with PowerShell 7 as-is.
If you find yourself working through this, two key changes you need to make:
1) Fix the header in UploadAzureStorageChunk to specify the content type as follows: $headers = @{ "x-ms-blob-type" = "BlockBlob" "Content-Type" = "text/plain; charset=iso-8859-1" };
More detail on this problem covered here: Add-IntuneWin32App.ps1 'CommitFile' failed error with PowerShell 7.4.0 · Issue #128 · MSEndpointMgr/IntuneWin32App (github.com)
2) Add a Content-Type header to the call to FinalizeAzureStorageUpload try { $headers = @{ "Content-Type" = "application/json" }; Invoke-RestMethod $uri -Method Put -Body $xml -Headers $headers; } catch { Write-Host -ForegroundColor Red $request; Write-Host -ForegroundColor Red $_.Exception.Message; throw; }