Skip to content

Commit bcb820a

Browse files
committed
1 parent bb69fa9 commit bcb820a

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/New-CippCoreRequest.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ function New-CippCoreRequest {
2121
}
2222

2323
if ($PSCmdlet.ShouldProcess("Processing request for $($Request.Params.CIPPEndpoint)")) {
24+
# Set script scope variables for Graph API to indicate HTTP request/high priority
25+
$script:XMsThrottlePriority = 'high'
26+
2427
if ((Get-Command -Name $FunctionName -ErrorAction SilentlyContinue) -or $FunctionName -eq 'Invoke-Me') {
2528
try {
2629
$Access = Test-CIPPAccess -Request $Request

Modules/CIPPCore/Public/GraphHelper/New-GraphBulkRequest.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ function New-GraphBulkRequest {
1717
if ($NoAuthCheck -or (Get-AuthorisedRequest -Uri $uri -TenantID $tenantid)) {
1818
$headers = Get-GraphToken -tenantid $tenantid -scope $scope -AsApp $asapp
1919

20+
if ($script:XMsThrottlePriority) {
21+
$headers['x-ms-throttle-priority'] = $script:XMsThrottlePriority
22+
}
23+
2024
$URL = "https://graph.microsoft.com/$Version/`$batch"
2125

2226
# Track consecutive Graph API failures

Modules/CIPPCore/Public/GraphHelper/New-GraphGetRequest.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ function New-GraphGetRequest {
3636
if ($ComplexFilter) {
3737
$headers['ConsistencyLevel'] = 'eventual'
3838
}
39+
40+
if ($script:XMsThrottlePriority) {
41+
$headers['x-ms-throttle-priority'] = $script:XMsThrottlePriority
42+
}
43+
3944
$nextURL = $uri
4045
if ($extraHeaders) {
4146
foreach ($key in $extraHeaders.Keys) {

0 commit comments

Comments
 (0)