Set-MgRequestContext
Sets request context for Microsoft Graph invocations
Syntax
Default (Default)
Set-MgRequestContext
[-RetryDelay <Int32>]
[-MaxRetry <Int32>]
[-RetriesTimeLimit <Int32>]
[-ClientTimeout <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Sets request context for Microsoft Graph invocations
Examples
Example 1: Set Http client timeout in seconds
PS C:\> Set-MgRequestContext -ClientTimeout 5
ClientTimeout RetryDelay MaxRetry RetriesTimeLimit
------------- ---------- -------- ----------------
00:00:05 3 2 00:00:00
Sets Http client timeout in seconds.
Example 2: Set the maximum time in seconds allowed for request retries
PS C:\> Set-MgRequestContext -RetriesTimeLimit 2
ClientTimeout RetryDelay MaxRetry RetriesTimeLimit
------------- ---------- -------- ----------------
00:00:05 3 2 00:00:02
Sets the maximum time in seconds allowed for request retries.
Example 3: Set the maximum number of retries for a request
PS C:\> Set-MgRequestContext -MaxRetry 2
ClientTimeout RetryDelay MaxRetry RetriesTimeLimit
------------- ---------- -------- ----------------
00:00:05 3 2 00:00:02
Sets the maximum number of retries for a request.
Example 4: Set the waiting time in seconds before retrying a request
PS C:\> Set-MgRequestContext -RetryDelay 3
ClientTimeout RetryDelay MaxRetry RetriesTimeLimit
------------- ---------- -------- ----------------
00:00:05 3 2 00:00:02
Sets the waiting time in seconds before retrying a request.
Parameters
-ClientTimeout
Sets the HTTP client timeout in seconds.
Parameter properties
Type: | Int32 |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: | SwitchParameter |
Default value: | False |
Supports wildcards: | False |
DontShow: | False |
Aliases: | cf |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-MaxRetry
Sets the maximum number of retries for a request with a maximum value of 10. This defaults to 3.
Parameter properties
Type: | Int32 |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-RetriesTimeLimit
Sets the maximum time in seconds allowed for request retries.
Parameter properties
Type: | Int32 |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-RetryDelay
Sets the waiting time in seconds before retrying a request with a maximum value of 180 seconds. This defaults to 3 seconds.
Parameter properties
Type: | Int32 |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
Type: | SwitchParameter |
Default value: | False |
Supports wildcards: | False |
DontShow: | False |
Aliases: | wi |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.