Skip to content

Fix variable reference for agent IP in key vault access#14383

Open
BalintBanyasz wants to merge 1 commit into
MicrosoftDocs:mainfrom
BalintBanyasz:main
Open

Fix variable reference for agent IP in key vault access#14383
BalintBanyasz wants to merge 1 commit into
MicrosoftDocs:mainfrom
BalintBanyasz:main

Conversation

@BalintBanyasz

Copy link
Copy Markdown

The sample currently sets the agentIP variable incorrectly:

echo "##vso[task.setvariable variable=agentIP]ip"

This stores the literal string ip instead of the value of $ip. As a result, the later Remove-AzKeyVaultNetworkRule step cannot remove the rule that was added, leaving the agent IP in the Key Vault network rules.

The sample should only use:

echo "##vso[task.setvariable variable=agentIP]$ip"

Likewise, the removal step should reference the pipeline variable:

$ipRange = "$(agentIP)/32"

This ensures the example works end-to-end.

@prmerger-automator

Copy link
Copy Markdown
Contributor

@BalintBanyasz : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

@prmerger-automator

Copy link
Copy Markdown
Contributor

@BalintBanyasz : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

@v-regandowner

Copy link
Copy Markdown
Contributor

@ramiMSFT

Can you review the proposed changes?

IMPORTANT: When the changes are ready for publication, adding a #sign-off comment is the best way to signal that the PR is ready for the review team to merge.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes an Azure Pipelines YAML sample in the Key Vault access documentation where the agent IP address was being stored and later referenced incorrectly, preventing the cleanup step from removing the temporary Key Vault network rule.

Changes:

  • Update the task.setvariable logging command to store the actual $ip value instead of the literal string ip.
  • Update the cleanup script to reference the pipeline variable ($(agentIP)) when constructing the /32 CIDR range.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants