Skip to content

Comments

Add Header parameter Invoke-ZtGraphRequest#894

Open
komalp2025 wants to merge 4 commits intomainfrom
header-parameter-Invoke-ZtGraphRequest
Open

Add Header parameter Invoke-ZtGraphRequest#894
komalp2025 wants to merge 4 commits intomainfrom
header-parameter-Invoke-ZtGraphRequest

Conversation

@komalp2025
Copy link
Collaborator

@komalp2025 komalp2025 commented Feb 13, 2026

Adding Header parameter to provide extra headers in Invoke-ZTGraphRequest. Earlier it was hardcoded to Consistency Level only.

PR results are updated at https://github.com/microsoft/ztspecs/issues/314

@komalp2025 komalp2025 changed the title Header parameter invoke zt graph request Add Header parameter Invoke-ZtGraphRequest Feb 13, 2026
@komalp2025 komalp2025 added the ready for review PR is ready for review and merging label Feb 13, 2026
Copy link
Collaborator

@merill merill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@komalp2025 In this new logic, if a Header is passed it is not including the ConsistencyLevel in the header collection. We need to include it based on the value provided in the ConsistencyLevel parameter

@komalp2025
Copy link
Collaborator Author

@komalp2025 In this new logic, if a Header is passed it is not including the ConsistencyLevel in the header collection. We need to include it based on the value provided in the ConsistencyLevel parameter

Hi @merill , this is already taken care of. Also if user has provided consistency level in header, it will also get reset to the value provided in consistency parameter. Please see below code snippet

PS C:\GitRepo\zerotrustassessment> $requestHeaders = if ($Headers) { $Headers.Clone() } else { @{} }
PS C:\GitRepo\zerotrustassessment> $requestHeaders                                               

Name                           Value
----                           -----
Content-Type                   application/json

PS C:\GitRepo\zerotrustassessment> $ConsistencyLevel = 'eventual'
PS C:\GitRepo\zerotrustassessment> $requestHeaders['ConsistencyLevel'] = $ConsistencyLevel
PS C:\GitRepo\zerotrustassessment> $requestHeaders

Name                           Value
----                           -----
Content-Type                   application/json
ConsistencyLevel               eventual
PS C:\GitRepo\zerotrustassessment>  $headers = @{"Content-Type" = "application/json" 
>> "ConsistencyLevel" = 'testvalue'}
PS C:\GitRepo\zerotrustassessment> $requestHeaders = if ($Headers) { $Headers.Clone() } else { @{} }       
PS C:\GitRepo\zerotrustassessment> $requestHeaders

Name                           Value
----                           -----
Content-Type                   application/json
ConsistencyLevel               testvalue

PS C:\GitRepo\zerotrustassessment> $requestHeaders['ConsistencyLevel'] = $ConsistencyLevel
PS C:\GitRepo\zerotrustassessment> $requestHeaders

Name                           Value
----                           -----
ConsistencyLevel               eventual
Content-Type                   application/json

@komalp2025 In this new logic, if a Header is passed it is not including the ConsistencyLevel in the header collection. We need to include it based on the value provided in the ConsistencyLevel parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review PR is ready for review and merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants