Skip to content

Skip Azure VM resource detection on App Service - #3209

Draft
Andreas Lillje (alillje) wants to merge 4 commits into
microsoft:mainfrom
alillje:fix/skip-vm-detector-on-app-service
Draft

Andreas Lillje (alillje) wants to merge 4 commits into
microsoft:mainfrom
alillje:fix/skip-vm-detector-on-app-service

Conversation

@alillje

Copy link
Copy Markdown

Fixes #3179.

Changes

  • Skip Azure VM resource detection when the WEBSITE_SITE_NAME environment variable identifies the application as running on Azure App Service.
  • Prevent the VM resource detector from making an unnecessary request to the Azure Instance Metadata Service.
  • Add a regression test verifying that VM metadata is not requested when running on App Service.

Checklist

  • I ran Unit Tests locally.
  • CHANGELOG.md updated with one line description of the fix, and a link to the original issue if available.

Copilot AI lite review requested due to automatic review settings August 26, 2026 08:00

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@alillje

Copy link
Copy Markdown
Author

Andreas Lillje (Andreas Lillje (@alillje)) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

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

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

Comment thread NETCORE/test/IntegrationTests.Tests/AzureVMResourceDetectorTests.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
{
try
{
if (Environment.GetEnvironmentVariable(ResourceAttributeConstants.AppServiceSiteNameEnvVar) != null)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this file is vendored from open-telemetry/opentelemetry-dotnet-contrib (link to this file), it's better to make the corresponding change in the upstream repository and sync it here.

Otherwise it could cause the behavior to diverge from the source project and be overwritten during a future vendor refresh. Ideally, the upstream implementation should become the source of truth, followed by a vendored update here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the guidance. I’ve now submitted the change upstream: open-telemetry/opentelemetry-dotnet-contrib#5167. I’ll keep this PR as a draft while the upstream change is reviewed.

@github-actions

Copy link
Copy Markdown

This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or pushing will instruct the bot to automatically remove the label. This bot runs once per day.

@github-actions github-actions Bot added the stale label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AddAzureVMDetector() called on App Service, throws HttpRequestException

3 participants