Skip to content

Conversation

@SimonWahlin
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings July 3, 2025 10:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a -Token parameter to Search-AzResourceGraph that lets users supply a raw access token, bypassing the regular sign-in flow. It updates the function logic and headers, adds Pester tests for both token and non-token scenarios, and documents the change in the changelog.

  • Introduce Token parameter and conditionally call Assert-AzureConnection
  • Update request header to use the provided or generated token
  • Add Pester tests for token vs. no-token invocation and bump changelog
  • Clean up extra blank lines in existing tests

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/Unit/Public/Search-AzResourceGraph.tests.ps1 Added tests to verify Assert-AzureConnection is called only when no token is supplied
tests/Unit/Private/Assert-AzureConnection.tests.ps1 Removed trailing blank lines for cleaner formatting
CHANGELOG.md Documented the new Token parameter under “Added”
AzResourceGraph/Public/Search-AzResourceGraph.ps1 Added Token parameter, updated connection logic, and modified the Authorization header
Comments suppressed due to low confidence (3)

tests/Unit/Public/Search-AzResourceGraph.tests.ps1:58

  • Mock the Assert-AzureConnection function at the start of the Describe block so Should -Invoke can correctly track invocations instead of running the real implementation.
    It 'Calls Assert-AzureConnection when not given a token' {

AzResourceGraph/Public/Search-AzResourceGraph.ps1:45

  • [nitpick] Clarify in the parameter description that -Token expects a raw access token (without the "Bearer " prefix) to avoid confusion.
.PARAMETER Token

AzResourceGraph/Public/Search-AzResourceGraph.ps1:96

  • [nitpick] Remove the extra blank line after the comma so the new [Parameter] attributes and $Token declaration align consistently with existing formatting.
        [int]$PageSize = 1000,

@github-actions
Copy link
Contributor

github-actions bot commented Jul 3, 2025

Linux Test Results

 1 files  ±0  16 suites  ±0   4s ⏱️ ±0s
71 tests +2  71 ✅ +2  0 💤 ±0  0 ❌ ±0 
72 runs  +2  72 ✅ +2  0 💤 ±0  0 ❌ ±0 

Results for commit 5c0cafb. ± Comparison against base commit b10b7b3.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 3, 2025

Win Test Results

 1 files  ±0  16 suites  ±0   4s ⏱️ -2s
71 tests +2  71 ✅ +2  0 💤 ±0  0 ❌ ±0 
72 runs  +2  72 ✅ +2  0 💤 ±0  0 ❌ ±0 

Results for commit 5c0cafb. ± Comparison against base commit b10b7b3.

@SimonWahlin SimonWahlin merged commit 83ea63e into main Jul 3, 2025
7 checks passed
@SimonWahlin SimonWahlin deleted the AddTokenParam branch July 5, 2025 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants