Freigeben über


Set-MgRequestContext

Sets request context for Microsoft Graph invocations

Syntax

Set-MgRequestContext
   [-RetryDelay <Int32>]
   [-MaxRetry <Int32>]
   [-RetriesTimeLimit <Int32>]
   [-ClientTimeout <Int32>]
   [-ProgressAction <ActionPreference>]
   [-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.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaxRetry

Sets the maximum number of retries for a request with a maximum value of 10. This defaults to 3.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ProgressAction

{{ Fill ProgressAction Description }}

Type:ActionPreference
Aliases:proga
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RetriesTimeLimit

Sets the maximum time in seconds allowed for request retries.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RetryDelay

Sets the waiting time in seconds before retrying a request with a maximum value of 180 seconds. This defaults to 3 seconds.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.Int32

Outputs

Microsoft.Graph.PowerShell.Authentication.Core.Interfaces.IRequestContext