Fix SAS renewal: use Resource as-is to avoid double deviceAppManagement segment#217
Open
jon-mathias-tandberg wants to merge 1 commit intoMSEndpointMgr:masterfrom
Conversation
…nt segment Co-authored-by: Cursor <cursoragent@cursor.com>
|
Top, finally fixed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When uploading large Win32 apps (e.g. >2 GB, many chunks), SAS URI renewal fails after ~7–15 minutes with:
Subsequent chunk uploads then get 403 (e.g. "Signed expiry time has to be after signed start time") because the SAS URI has expired and renewal did not succeed. The app is created in Intune but content never finishes uploading.
Root cause
In
Add-IntuneWin32App.ps1,$FilesUriis set to the full resource path including thedeviceAppManagement/prefix:Invoke-AzureStorageBlobUploadRenew.ps1then prependsdeviceAppManagement/again when calling Graph:"deviceAppManagement/$($Resource)/renewUpload""deviceAppManagement/$($Resource)"So the effective path becomes
deviceAppManagement/deviceAppManagement/mobileApps/..., which is invalid. Graph returns "Resource not found for the segment 'deviceAppManagement'".Per Microsoft Graph, the correct path is:
POST /deviceAppManagement/mobileApps/{id}/contentVersions/{contentId}/files/{fileId}/renewUploadThe caller already passes the full path; Renew should use it as-is and only append
/renewUploadfor the POST.Solution
Use
$Resourcewithout prependingdeviceAppManagement/:"$($Resource)/renewUpload"$ResourceThis has been validated in production with large Win32 packages (e.g. 3+ GB, 500+ chunks) where renewal now succeeds and upload completes.