From 3f3d44b8e4b2b2a2e9484c362bf64a92422de280 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 08:13:43 -0500 Subject: [PATCH 01/20] Bump step-security/harden-runner from 2.10.4 to 2.11.0 (#44917) Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.10.4 to 2.11.0. - [Release notes](https://github.com/step-security/harden-runner/releases) - [Commits](https://github.com/step-security/harden-runner/compare/cb605e52c26070c328afc4562f0b4ada7618a84e...4d991eb9b905ef189e4c376166672c3f2f230481) --- updated-dependencies: - dependency-name: step-security/harden-runner dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check-for-build-warnings.yml | 2 +- .github/workflows/cleanrepo-orphaned-articles.yml | 2 +- .github/workflows/cleanrepo-orphaned-images.yml | 2 +- .github/workflows/cleanrepo-orphaned-includes.yml | 2 +- .github/workflows/cleanrepo-orphaned-snippets.yml | 2 +- .github/workflows/cleanrepo-redirect-hops.yml | 2 +- .github/workflows/cleanrepo-relative-links.yml | 2 +- .github/workflows/cleanrepo-replace-redirects.yml | 2 +- .github/workflows/dependabot-bot.yml | 2 +- .github/workflows/dependency-review.yml | 2 +- .github/workflows/do-not-merge-label-check.yml | 2 +- .github/workflows/docs-verifier.yml | 2 +- .github/workflows/live-protection.yml | 2 +- .github/workflows/markdownlint.yml | 2 +- .github/workflows/profanity-filter.yml | 2 +- .github/workflows/quest-bulk.yml | 2 +- .github/workflows/quest.yml | 2 +- .github/workflows/scorecards.yml | 2 +- .github/workflows/snippets5000.yml | 2 +- .github/workflows/stale.yml | 2 +- .github/workflows/version-sweep.yml | 2 +- .github/workflows/whats-new.yml | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/check-for-build-warnings.yml b/.github/workflows/check-for-build-warnings.yml index 404fdcecbe119..1b2d4cbcae680 100644 --- a/.github/workflows/check-for-build-warnings.yml +++ b/.github/workflows/check-for-build-warnings.yml @@ -16,7 +16,7 @@ jobs: pull-requests: write steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/cleanrepo-orphaned-articles.yml b/.github/workflows/cleanrepo-orphaned-articles.yml index c11af177eec4a..f871aeb5d06be 100644 --- a/.github/workflows/cleanrepo-orphaned-articles.yml +++ b/.github/workflows/cleanrepo-orphaned-articles.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/cleanrepo-orphaned-images.yml b/.github/workflows/cleanrepo-orphaned-images.yml index f75c8f097ca88..d0e94623d3d90 100644 --- a/.github/workflows/cleanrepo-orphaned-images.yml +++ b/.github/workflows/cleanrepo-orphaned-images.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/cleanrepo-orphaned-includes.yml b/.github/workflows/cleanrepo-orphaned-includes.yml index b7c6a5689b3de..8aedbfd4d9a96 100644 --- a/.github/workflows/cleanrepo-orphaned-includes.yml +++ b/.github/workflows/cleanrepo-orphaned-includes.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/cleanrepo-orphaned-snippets.yml b/.github/workflows/cleanrepo-orphaned-snippets.yml index 0e9524e71d0a7..15a3108c06ef7 100644 --- a/.github/workflows/cleanrepo-orphaned-snippets.yml +++ b/.github/workflows/cleanrepo-orphaned-snippets.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/cleanrepo-redirect-hops.yml b/.github/workflows/cleanrepo-redirect-hops.yml index 88f080c660f9b..b60d326197fe7 100644 --- a/.github/workflows/cleanrepo-redirect-hops.yml +++ b/.github/workflows/cleanrepo-redirect-hops.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/cleanrepo-relative-links.yml b/.github/workflows/cleanrepo-relative-links.yml index 44fa28bb6e32e..d2d5f7ae694ee 100644 --- a/.github/workflows/cleanrepo-relative-links.yml +++ b/.github/workflows/cleanrepo-relative-links.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/cleanrepo-replace-redirects.yml b/.github/workflows/cleanrepo-replace-redirects.yml index 7b79aeb4ae90c..b584febc20508 100644 --- a/.github/workflows/cleanrepo-replace-redirects.yml +++ b/.github/workflows/cleanrepo-replace-redirects.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/dependabot-bot.yml b/.github/workflows/dependabot-bot.yml index a6c86b473cf13..1cb1f656d183a 100644 --- a/.github/workflows/dependabot-bot.yml +++ b/.github/workflows/dependabot-bot.yml @@ -26,7 +26,7 @@ jobs: # Checkout the repo into the workspace within the VM steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 1b495dbce772e..4a15a1dfadb64 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/do-not-merge-label-check.yml b/.github/workflows/do-not-merge-label-check.yml index 630a7b04b6a40..1fb7cc13148a1 100644 --- a/.github/workflows/do-not-merge-label-check.yml +++ b/.github/workflows/do-not-merge-label-check.yml @@ -22,7 +22,7 @@ jobs: - 'DO NOT MERGE' steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/docs-verifier.yml b/.github/workflows/docs-verifier.yml index 68f6bc1a33270..8547631a7f59b 100644 --- a/.github/workflows/docs-verifier.yml +++ b/.github/workflows/docs-verifier.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/live-protection.yml b/.github/workflows/live-protection.yml index 1aa5631ba4f6a..7578d49e7c588 100644 --- a/.github/workflows/live-protection.yml +++ b/.github/workflows/live-protection.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index 49040588cea36..61b9c792d4e5e 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/profanity-filter.yml b/.github/workflows/profanity-filter.yml index 4096fe053a195..d683bd46965c9 100644 --- a/.github/workflows/profanity-filter.yml +++ b/.github/workflows/profanity-filter.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/quest-bulk.yml b/.github/workflows/quest-bulk.yml index 33928ce1eaf9c..a9c68b90686e6 100644 --- a/.github/workflows/quest-bulk.yml +++ b/.github/workflows/quest-bulk.yml @@ -26,7 +26,7 @@ jobs: if: ${{ github.repository_owner == 'dotnet' }} steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/quest.yml b/.github/workflows/quest.yml index f1cfb319b1340..8ed7c7cf7809e 100644 --- a/.github/workflows/quest.yml +++ b/.github/workflows/quest.yml @@ -29,7 +29,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index aadc9669d4864..35db8516377ba 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/snippets5000.yml b/.github/workflows/snippets5000.yml index 8481e4177ec8a..9031f1ab442fd 100644 --- a/.github/workflows/snippets5000.yml +++ b/.github/workflows/snippets5000.yml @@ -31,7 +31,7 @@ jobs: steps: # Checkout the repository for the PR - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 2017d293faadb..eca20cd68d3fc 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/version-sweep.yml b/.github/workflows/version-sweep.yml index 35a5084201d79..60597066c7963 100644 --- a/.github/workflows/version-sweep.yml +++ b/.github/workflows/version-sweep.yml @@ -34,7 +34,7 @@ jobs: # Start the .NET version updater action # A composite of the .NET Version Sweeper and the .NET Upgrade Assistant - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit diff --git a/.github/workflows/whats-new.yml b/.github/workflows/whats-new.yml index 22d31435a4ecf..3555f6b702ab7 100644 --- a/.github/workflows/whats-new.yml +++ b/.github/workflows/whats-new.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 with: egress-policy: audit From e0ebea3597a491dc843d6c8de7229e5d4337745c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:14:28 +0000 Subject: [PATCH 02/20] Bump the dotnet group (#44955) Bumps the dotnet group in /docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTestNet8 with 2 updates: [MSTest.TestAdapter](https://github.com/microsoft/testfx) and [MSTest.TestFramework](https://github.com/microsoft/testfx). Updates `MSTest.TestAdapter` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) Updates `MSTest.TestFramework` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: MSTest.TestAdapter dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../csharp/StringLibraryTestNet8/StringLibraryTest.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTestNet8/StringLibraryTest.csproj b/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTestNet8/StringLibraryTest.csproj index 285b39d558e3a..fc39882d4fda4 100644 --- a/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTestNet8/StringLibraryTest.csproj +++ b/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTestNet8/StringLibraryTest.csproj @@ -11,8 +11,8 @@ - - + + From b493138c0760175f72ee356573a17338602ad5a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:15:16 +0000 Subject: [PATCH 03/20] Bump the dotnet group (#44957) Bumps the dotnet group in /docs/core/testing/snippets/order-unit-tests/csharp with 2 updates: [MSTest.TestAdapter](https://github.com/microsoft/testfx) and [MSTest.TestFramework](https://github.com/microsoft/testfx). Updates `MSTest.TestAdapter` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) Updates `MSTest.TestFramework` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: MSTest.TestAdapter dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../csharp/MSTest.Project/MSTest.Project.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/testing/snippets/order-unit-tests/csharp/MSTest.Project/MSTest.Project.csproj b/docs/core/testing/snippets/order-unit-tests/csharp/MSTest.Project/MSTest.Project.csproj index a06778617eec7..7517eba6d0382 100644 --- a/docs/core/testing/snippets/order-unit-tests/csharp/MSTest.Project/MSTest.Project.csproj +++ b/docs/core/testing/snippets/order-unit-tests/csharp/MSTest.Project/MSTest.Project.csproj @@ -9,8 +9,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive From b88f60f2be4f375f0f8c2c5934ed40b07dce550a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:15:31 +0000 Subject: [PATCH 04/20] Bump the dotnet group (#44956) Bumps the dotnet group in /docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Test with 2 updates: [MSTest.TestAdapter](https://github.com/microsoft/testfx) and [MSTest.TestFramework](https://github.com/microsoft/testfx). Updates `MSTest.TestAdapter` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) Updates `MSTest.TestFramework` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: MSTest.TestAdapter dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../MakeConst/MakeConst.Test/MakeConst.Test.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Test/MakeConst.Test.csproj b/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Test/MakeConst.Test.csproj index b0415896f7b2b..e112df3b0101d 100644 --- a/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Test/MakeConst.Test.csproj +++ b/docs/csharp/roslyn-sdk/tutorials/snippets/how-to-write-csharp-analyzer-code-fix/MakeConst/MakeConst.Test/MakeConst.Test.csproj @@ -9,8 +9,8 @@ - - + + From d58a4f402d52988325eda06e8f65f74b03a52a1a Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 19 Feb 2025 05:15:57 -0800 Subject: [PATCH 05/20] Update package index with latest published versions (#44944) --- docs/azure/includes/dotnet-all.md | 6 +++--- docs/azure/includes/dotnet-new.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 959bf923de9f5..6a1a98357bd18 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -78,7 +78,7 @@ | Monitor Query | NuGet [1.6.0](https://www.nuget.org/packages/Azure.Monitor.Query/1.6.0) | [docs](/dotnet/api/overview/azure/Monitor.Query-readme) | GitHub [1.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.6.0/sdk/monitor/Azure.Monitor.Query/) | | NUnit ? Microsoft Playwright Testing | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.Developer.MicrosoftPlaywrightTesting.NUnit/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Developer.MicrosoftPlaywrightTesting.NUnit-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Developer.MicrosoftPlaywrightTesting.NUnit_1.0.0-beta.4/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.NUnit/) | | OpenAI Assistants | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.AI.OpenAI.Assistants/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.OpenAI.Assistants-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI.Assistants_1.0.0-beta.4/sdk/openai/Azure.AI.OpenAI.Assistants/) | -| OpenAI Inference | NuGet [2.1.0](https://www.nuget.org/packages/Azure.AI.OpenAI/2.1.0)
NuGet [2.2.0-beta.1](https://www.nuget.org/packages/Azure.AI.OpenAI/2.2.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.OpenAI-readme) | GitHub [2.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.1.0/sdk/openai/Azure.AI.OpenAI/)
GitHub [2.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.2.0-beta.1/sdk/openai/Azure.AI.OpenAI/) | +| OpenAI Inference | NuGet [2.1.0](https://www.nuget.org/packages/Azure.AI.OpenAI/2.1.0)
NuGet [2.2.0-beta.2](https://www.nuget.org/packages/Azure.AI.OpenAI/2.2.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.OpenAI-readme) | GitHub [2.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.1.0/sdk/openai/Azure.AI.OpenAI/)
GitHub [2.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.2.0-beta.2/sdk/openai/Azure.AI.OpenAI/) | | OpenTelemetry AspNetCore | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.AspNetCore/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.AspNetCore/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.AspNetCore-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.AspNetCore_1.2.0/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.AspNetCore_1.3.0-beta.2/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/) | | OpenTelemetry Exporter | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.3.0)
NuGet [1.4.0-beta.2](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.4.0-beta.2) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.Exporter-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.3.0/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/)
GitHub [1.4.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.4.0-beta.2/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/) | | Personalizer | NuGet [2.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Personalizer/2.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Personalizer-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [2.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Personalizer_2.0.0-beta.2/sdk/personalizer/Azure.AI.Personalizer/) | @@ -399,7 +399,7 @@ | Common | NuGet [2.2.1](https://www.nuget.org/packages/Microsoft.Azure.Common/2.2.1) | | | | Common - Dependencies | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Common.Dependencies/1.0.0) | | | | Computer Vision | NuGet [7.0.1](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.ComputerVision/7.0.1) | | GitHub [7.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Vision.ComputerVision_6.0.0-preview.1/sdk/cognitiveservices/Vision.ComputerVision) | -| Cosmos DB | NuGet [3.42.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.42.0)
NuGet [3.48.0-preview.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.48.0-preview.0) | [docs](https://learn.microsoft.com/dotnet/api/overview/azure/cosmosdb) | GitHub [3.42.0](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/3.12.0/Microsoft.Azure.Cosmos) | +| Cosmos DB | NuGet [3.47.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.47.0)
NuGet [3.48.0-preview.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.48.0-preview.0) | [docs](https://learn.microsoft.com/dotnet/api/overview/azure/cosmosdb) | GitHub [3.47.0](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/3.12.0/Microsoft.Azure.Cosmos) | | Custom Image Search | NuGet [2.1.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.BingCustomImageSearch/2.1.0-preview.1) | | GitHub [2.1.0-preview.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Search.BingCustomImageSearch_2.1.0-preview.1/sdk/cognitiveservices/Search.BingCustomImageSearch) | | Custom Image Search | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.CustomImageSearch/2.0.0) | | | | Custom Search | NuGet [2.1.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.BingCustomSearch/2.1.0-preview.1) | | GitHub [2.1.0-preview.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Search.BingCustomSearch_2.1.0-preview.1/sdk/cognitiveservices/Search.BingCustomSearch) | @@ -525,7 +525,7 @@ | Microsoft.Azure.Functions.Worker.Extensions.Abstractions | NuGet [1.3.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Abstractions/1.3.0) | | | | Microsoft.Azure.Functions.Worker.Extensions.ApplicationInsights | NuGet [1.0.0-preview4](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.ApplicationInsights/1.0.0-preview4) | | | | Microsoft.Azure.Functions.Worker.Extensions.CosmosDB | NuGet [4.12.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.CosmosDB/4.12.0) | | | -| Microsoft.Azure.Functions.Worker.Extensions.EventGrid | NuGet [3.4.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.EventGrid/3.4.2) | | | +| Microsoft.Azure.Functions.Worker.Extensions.EventGrid | NuGet [3.4.3](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.EventGrid/3.4.3) | | | | Microsoft.Azure.Functions.Worker.Extensions.EventHubs | NuGet [6.3.6](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.EventHubs/6.3.6) | | | | Microsoft.Azure.Functions.Worker.Extensions.Http | NuGet [3.3.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Http/3.3.0) | | | | Microsoft.Azure.Functions.Worker.Extensions.Kafka | NuGet [4.0.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Kafka/4.0.0) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 1e0fac1c2de40..59b2809fa90ee 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -79,7 +79,7 @@ | Monitor Query | NuGet [1.6.0](https://www.nuget.org/packages/Azure.Monitor.Query/1.6.0) | [docs](/dotnet/api/overview/azure/Monitor.Query-readme) | GitHub [1.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.6.0/sdk/monitor/Azure.Monitor.Query/) | | NUnit ? Microsoft Playwright Testing | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.Developer.MicrosoftPlaywrightTesting.NUnit/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Developer.MicrosoftPlaywrightTesting.NUnit-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Developer.MicrosoftPlaywrightTesting.NUnit_1.0.0-beta.4/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting.NUnit/) | | OpenAI Assistants | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.AI.OpenAI.Assistants/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.OpenAI.Assistants-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI.Assistants_1.0.0-beta.4/sdk/openai/Azure.AI.OpenAI.Assistants/) | -| OpenAI Inference | NuGet [2.1.0](https://www.nuget.org/packages/Azure.AI.OpenAI/2.1.0)
NuGet [2.2.0-beta.1](https://www.nuget.org/packages/Azure.AI.OpenAI/2.2.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.OpenAI-readme) | GitHub [2.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.1.0/sdk/openai/Azure.AI.OpenAI/)
GitHub [2.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.2.0-beta.1/sdk/openai/Azure.AI.OpenAI/) | +| OpenAI Inference | NuGet [2.1.0](https://www.nuget.org/packages/Azure.AI.OpenAI/2.1.0)
NuGet [2.2.0-beta.2](https://www.nuget.org/packages/Azure.AI.OpenAI/2.2.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.OpenAI-readme) | GitHub [2.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.1.0/sdk/openai/Azure.AI.OpenAI/)
GitHub [2.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_2.2.0-beta.2/sdk/openai/Azure.AI.OpenAI/) | | OpenTelemetry AspNetCore | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.AspNetCore/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.AspNetCore/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.AspNetCore-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.AspNetCore_1.2.0/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.AspNetCore_1.3.0-beta.2/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/) | | OpenTelemetry Exporter | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.3.0)
NuGet [1.4.0-beta.2](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.4.0-beta.2) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.Exporter-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.3.0/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/)
GitHub [1.4.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.4.0-beta.2/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/) | | OpenTelemetry LiveMetrics | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.LiveMetrics/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.LiveMetrics-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.LiveMetrics_1.0.0-beta.3/sdk/monitor/Azure.Monitor.OpenTelemetry.LiveMetrics/) | From 97bb9a210e989c92ace972f5f16b6eb4379f1577 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:17:52 +0000 Subject: [PATCH 06/20] Bump MSTest.TestFramework (#44958) Bumps the dotnet group in /docs/csharp/language-reference/operators/snippets/shared with 1 update: [MSTest.TestFramework](https://github.com/microsoft/testfx). Updates `MSTest.TestFramework` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../operators/snippets/shared/operators.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/language-reference/operators/snippets/shared/operators.csproj b/docs/csharp/language-reference/operators/snippets/shared/operators.csproj index 743c3a8f38201..73e2da4f9d7e6 100644 --- a/docs/csharp/language-reference/operators/snippets/shared/operators.csproj +++ b/docs/csharp/language-reference/operators/snippets/shared/operators.csproj @@ -10,7 +10,7 @@ - + From 291a423c7a307f50944ab8ebacc5f8b62f3a54c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:20:15 +0000 Subject: [PATCH 07/20] Bump MSTest.TestFramework (#44959) Bumps the dotnet group in /docs/core/whats-new/snippets/dotnet-8/csharp/ConsoleApp with 1 update: [MSTest.TestFramework](https://github.com/microsoft/testfx). Updates `MSTest.TestFramework` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../snippets/dotnet-8/csharp/ConsoleApp/Project.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/whats-new/snippets/dotnet-8/csharp/ConsoleApp/Project.csproj b/docs/core/whats-new/snippets/dotnet-8/csharp/ConsoleApp/Project.csproj index 38eef774f994d..5b1f8905c078c 100644 --- a/docs/core/whats-new/snippets/dotnet-8/csharp/ConsoleApp/Project.csproj +++ b/docs/core/whats-new/snippets/dotnet-8/csharp/ConsoleApp/Project.csproj @@ -12,7 +12,7 @@ - +
From 3a8cd3afc5d90f3bbecc41bb318fdbc0f7d74875 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:22:56 +0000 Subject: [PATCH 08/20] Bump the dotnet group (#44960) Bumps the dotnet group in /docs/core/testing/snippets/unit-testing-using-mstest/csharp/PrimeService.Tests with 2 updates: [MSTest.TestAdapter](https://github.com/microsoft/testfx) and [MSTest.TestFramework](https://github.com/microsoft/testfx). Updates `MSTest.TestAdapter` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) Updates `MSTest.TestFramework` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: MSTest.TestAdapter dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../csharp/PrimeService.Tests/PrimeService.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/testing/snippets/unit-testing-using-mstest/csharp/PrimeService.Tests/PrimeService.Tests.csproj b/docs/core/testing/snippets/unit-testing-using-mstest/csharp/PrimeService.Tests/PrimeService.Tests.csproj index 2da4409e42cb8..44c2f3f71cf9d 100644 --- a/docs/core/testing/snippets/unit-testing-using-mstest/csharp/PrimeService.Tests/PrimeService.Tests.csproj +++ b/docs/core/testing/snippets/unit-testing-using-mstest/csharp/PrimeService.Tests/PrimeService.Tests.csproj @@ -8,8 +8,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive From 958e8e7f718684be9fa39479ea1942689b0ab4b4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:24:27 +0000 Subject: [PATCH 09/20] Bump the dotnet group (#44961) Bumps the dotnet group in /docs/core/tutorials/snippets/library-with-visual-studio/vb/StringLibraryTest with 2 updates: [MSTest.TestAdapter](https://github.com/microsoft/testfx) and [MSTest.TestFramework](https://github.com/microsoft/testfx). Updates `MSTest.TestAdapter` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) Updates `MSTest.TestFramework` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: MSTest.TestAdapter dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../vb/StringLibraryTest/StringLibraryTest.vbproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/tutorials/snippets/library-with-visual-studio/vb/StringLibraryTest/StringLibraryTest.vbproj b/docs/core/tutorials/snippets/library-with-visual-studio/vb/StringLibraryTest/StringLibraryTest.vbproj index e06fe03ce76cd..37a41c08761cf 100644 --- a/docs/core/tutorials/snippets/library-with-visual-studio/vb/StringLibraryTest/StringLibraryTest.vbproj +++ b/docs/core/tutorials/snippets/library-with-visual-studio/vb/StringLibraryTest/StringLibraryTest.vbproj @@ -8,8 +8,8 @@ - - + + From af50bd7e235fdf2385c3488ef61e6a6ec25cbcac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:25:38 +0000 Subject: [PATCH 10/20] Bump the dotnet group (#44962) Bumps the dotnet group in /docs/core/tutorials/snippets/library-with-visual-studio/vb with 2 updates: [MSTest.TestAdapter](https://github.com/microsoft/testfx) and [MSTest.TestFramework](https://github.com/microsoft/testfx). Updates `MSTest.TestAdapter` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) Updates `MSTest.TestFramework` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: MSTest.TestAdapter dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> From ea1d886e70c729110dab0d4136cfbf32dde68cbc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:29:58 +0000 Subject: [PATCH 11/20] Bump MSTest (#44963) Bumps the dotnet group in /docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTest with 1 update: [MSTest](https://github.com/microsoft/testfx). Updates `MSTest` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: MSTest dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../csharp/StringLibraryTest/StringLibraryTest.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTest/StringLibraryTest.csproj b/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTest/StringLibraryTest.csproj index a3c7fcd220bb6..532e94ff22ffa 100644 --- a/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTest/StringLibraryTest.csproj +++ b/docs/core/tutorials/snippets/library-with-visual-studio/csharp/StringLibraryTest/StringLibraryTest.csproj @@ -7,7 +7,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From d9840e456da2256648e650a20ac260bc94adb930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 19 Feb 2025 14:42:22 +0100 Subject: [PATCH 12/20] Improve MSTest testconfig doc (#44951) --- .../testing/unit-testing-mstest-configure.md | 114 ++++++++++++++++-- 1 file changed, 107 insertions(+), 7 deletions(-) diff --git a/docs/core/testing/unit-testing-mstest-configure.md b/docs/core/testing/unit-testing-mstest-configure.md index 1a1a884c121bb..dc05d882be0b6 100644 --- a/docs/core/testing/unit-testing-mstest-configure.md +++ b/docs/core/testing/unit-testing-mstest-configure.md @@ -117,13 +117,29 @@ MSTest settings are grouped by functionality that are described in the sections | enableBaseClassTestMethodsFromOtherAssemblies | true | A value indicating whether to enable discovery of test methods from base classes in a different assembly from the inheriting test class. | | classCleanupLifecycle | EndOfAssembly | If you want the class cleanup to occur at the end of the class, set it to **EndOfClass**. | -#### AssemblyResolution settings +#### `assemblyResolution` settings + +All the settings in this section belong to the `assemblyResolution` element. | Entry | Default | Description | |-------|---------|-------------| | paths | None | You can specify paths to extra assemblies when finding and running unit tests. For example, use these paths for dependency assemblies that aren't in the same directory as the test assembly. You can specify a path in the shape `{ "path": "...", "includeSubDirectories": "true/false" }`. | -#### Deployment settings +Example: + +```json +{ + "mstest": { + "assemblyResolution": { + { "path": "...", "includeSubDirectories": "true/false" } + } + } +} +``` + +#### `deployment` settings + +All the settings in this section belong to the `deployment` element. | Entry | Default | Description | |-------|---------|-------------| @@ -131,13 +147,43 @@ MSTest settings are grouped by functionality that are described in the sections | deployTestSourceDependencies | true | Indicates whether the test source references are to be deployed. | | enabled | true | If you set the value to **false**, deployment items that you specify in your test method aren't copied to the deployment directory. | -#### Output settings +Example: + +```json +{ + "mstest": { + "deployment": { + "deleteDeploymentDirectoryAfterTestRunIsComplete": true, + "deployTestSourceDependencies": true, + "enabled": true + } + } +} +``` + +#### `output` settings + +All the settings in this section belong to the `output` element. | Entry | Default | Description | |-------|---------|-------------| -| captureTrace | false | Capture text messages coming from the `Console.Write*`, `Trace.Write*`, and `Debug.Write*` APIs that will be associated to the current running test. | +| captureTrace | true | Capture text messages coming from the `Console.Write*`, `Trace.Write*`, and `Debug.Write*` APIs that will be associated to the current running test. | + +Example: + +```json +{ + "mstest": { + "output": { + "captureTrace": false + } + } +} +``` + +#### `parallelism` settings -#### Parallelism settings +All the settings in this section belong to the `parallelism` element. | Entry | Default | Description | |-------|---------|-------------| @@ -145,7 +191,23 @@ MSTest settings are grouped by functionality that are described in the sections | scope | class | The scope of parallelization. You can set it to `method`. The default, `class`, corresponds to running all tests of a given class sequentially but multiple classes in parallel. | | workers | 0 | The number of threads/workers to be used for parallelization. The default value maps to the number of processors on the current machine. | -#### Execution settings +Example: + +```json +{ + "mstest": { + "parallelism": { + "enabled": true, + "scope": "method", + "workers": 32 + } + } +} +``` + +#### `execution` settings + +All the settings in this section belong to the `execution` element. | Entry | Default | Description | |-------|---------|-------------| @@ -156,7 +218,26 @@ MSTest settings are grouped by functionality that are described in the sections | treatClassAndAssemblyCleanupWarningsAsErrors | false | To see your failures in class cleanups as errors, set this value to **true**. | | treatDiscoveryWarningsAsErrors | false | To report test discovery warnings as errors, set this value to **true**. | -#### Timeout settings +Example: + +```json +{ + "mstest": { + "execution": { + "considerEmptyDataSourceAsInconclusive": false, + "considerFixturesAsSpecialTests": false, + "mapInconclusiveToFailed": true, + "mapNotRunnableToFailed": true, + "treatClassAndAssemblyCleanupWarningsAsErrors": false, + "treatDiscoveryWarningsAsErrors": false + } + } +} +``` + +#### `timeout` settings + +All the settings in this section belong to the `timeout` element. | Entry | Default | Description | |-------|---------|-------------| @@ -172,6 +253,25 @@ MSTest settings are grouped by functionality that are described in the sections > [!NOTE] > `[Timeout]` attribute specified on a method overrides the global timeout. For example, `[Timeout(1000)]` on a method marked with [AssemblyCleanup] will override the global `assemblyCleanup` timeout. +Example: + +```json +{ + "mstest": { + "timeout": { + "assemblyCleanup": 0, + "assemblyInitialize": 0, + "classCleanup": 0, + "classInitialize": 0, + "test": 0, + "testCleanup": 0, + "testInitialize": 0, + "useCooperativeCancellation": false + } + } +} +``` + ### Example *testconfig.json* file The following JSON shows the contents of a typical *.testconfig.json* file. Copy this code and edit it to suit your needs. From e5a746de5e570346b3c48aea43c4093f033887ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:43:06 +0000 Subject: [PATCH 13/20] Bump the dotnet group (#44964) Bumps the dotnet group in /samples/snippets/core/testing/unit-testing-vb-mstest/vb with 2 updates: [MSTest.TestAdapter](https://github.com/microsoft/testfx) and [MSTest.TestFramework](https://github.com/microsoft/testfx). Updates `MSTest.TestAdapter` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) Updates `MSTest.TestFramework` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: MSTest.TestAdapter dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../vb/PrimeService.Tests/PrimeService.Tests.vbproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/core/testing/unit-testing-vb-mstest/vb/PrimeService.Tests/PrimeService.Tests.vbproj b/samples/snippets/core/testing/unit-testing-vb-mstest/vb/PrimeService.Tests/PrimeService.Tests.vbproj index 867af487d61fa..b1ffb04dcebb4 100644 --- a/samples/snippets/core/testing/unit-testing-vb-mstest/vb/PrimeService.Tests/PrimeService.Tests.vbproj +++ b/samples/snippets/core/testing/unit-testing-vb-mstest/vb/PrimeService.Tests/PrimeService.Tests.vbproj @@ -8,8 +8,8 @@ - - + + From 2765a85b323e6b288abcaaf830a901dc46ac33b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:43:49 +0000 Subject: [PATCH 14/20] Bump the dotnet group (#44965) Bumps the dotnet group in /docs/core/testing/snippets/testcontext/csharp with 2 updates: [Microsoft.NETFramework.ReferenceAssemblies](https://github.com/Microsoft/dotnet) and [MSTest](https://github.com/microsoft/testfx). Updates `Microsoft.NETFramework.ReferenceAssemblies` from 1.0.3 to 1.0.3 - [Commits](https://github.com/Microsoft/dotnet/commits) Updates `MSTest` from 3.8.0 to 3.8.2 - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.8.0...v3.8.2) --- updated-dependencies: - dependency-name: Microsoft.NETFramework.ReferenceAssemblies dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: MSTest dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- docs/core/testing/snippets/testcontext/csharp/project.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/testing/snippets/testcontext/csharp/project.csproj b/docs/core/testing/snippets/testcontext/csharp/project.csproj index 0464df4bca0fd..362ce71d94d9b 100644 --- a/docs/core/testing/snippets/testcontext/csharp/project.csproj +++ b/docs/core/testing/snippets/testcontext/csharp/project.csproj @@ -8,7 +8,7 @@ - + From fd0269f6029b630bb539c83cbe2f6d2d525d9d02 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Wed, 19 Feb 2025 21:45:33 +0800 Subject: [PATCH 15/20] Fix incorrect "then" usage (#44953) --- docs/framework/tools/ngen-exe-native-image-generator.md | 2 +- docs/framework/wcf/feature-details/messaging-protocols.md | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/framework/tools/ngen-exe-native-image-generator.md b/docs/framework/tools/ngen-exe-native-image-generator.md index bd62caf138b1b..44b39be01101d 100644 --- a/docs/framework/tools/ngen-exe-native-image-generator.md +++ b/docs/framework/tools/ngen-exe-native-image-generator.md @@ -402,7 +402,7 @@ You can use the [jitCompilationStart](../debug-trace-profile/jitcompilationstart ### Opting out of native image generation -In some cases, NGen.exe may have difficulty generating a native image for a specific method, or you may prefer that the method be JIT compiled rather then compiled to a native image. In this case, you can use the `System.Runtime.BypassNGenAttribute` attribute to prevent NGen.exe from generating a native image for a particular method. The attribute must be applied individually to each method whose code you do not want to include in the native image. NGen.exe recognizes the attribute and does not generate code in the native image for the corresponding method. +In some cases, NGen.exe may have difficulty generating a native image for a specific method, or you may prefer that the method be JIT compiled rather than compiled to a native image. In this case, you can use the `System.Runtime.BypassNGenAttribute` attribute to prevent NGen.exe from generating a native image for a particular method. The attribute must be applied individually to each method whose code you do not want to include in the native image. NGen.exe recognizes the attribute and does not generate code in the native image for the corresponding method. Note, however, that `BypassNGenAttribute` is not defined as a type in the .NET Framework Class Library. In order to consume the attribute in your code, you must first define it as follows: diff --git a/docs/framework/wcf/feature-details/messaging-protocols.md b/docs/framework/wcf/feature-details/messaging-protocols.md index 81f2d1de423af..d7a49f79bc79f 100644 --- a/docs/framework/wcf/feature-details/messaging-protocols.md +++ b/docs/framework/wcf/feature-details/messaging-protocols.md @@ -1,8 +1,7 @@ --- -description: "Learn more about: Messaging Protocols" title: "Messaging Protocols" +description: "Learn more about: Messaging Protocols" ms.date: "03/30/2017" -ms.assetid: 5b20bca7-87b3-4c8f-811b-f215b5987104 --- # Messaging Protocols @@ -635,7 +634,7 @@ Content-Type: application/octet-stream #### WCF Secure SOAP 1.2 Message Encoded Using MTOM -In this example, a message is encoded using MTOM and SOAP 1.2 that is protected using WS-Security. The binary parts identified for encoding are the contents of the `BinarySecurityToken`, `CipherValue` of the `EncryptedData` corresponding to the encrypted signature and encrypted body. Note that the `CipherValue` of the `EncryptedKey` was not identified for optimization by WCF, because its length is less then 1024 bytes. +In this example, a message is encoded using MTOM and SOAP 1.2 that is protected using WS-Security. The binary parts identified for encoding are the contents of the `BinarySecurityToken`, `CipherValue` of the `EncryptedData` corresponding to the encrypted signature and encrypted body. Note that the `CipherValue` of the `EncryptedKey` was not identified for optimization by WCF, because its length is less than 1024 bytes. ```http POST http://131.107.72.15/Mtom/service.svc/Soap12MtomSecureSignEncrypt HTTP/1.1 From 9a120c2aab85284705f758490dfd8097e2443a5b Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Wed, 19 Feb 2025 11:59:08 -0500 Subject: [PATCH 16/20] Remove misleading sample (#44966) Fixes #29824 This sample really doesn't involve a discard. It's trying to name two different variables `_`. --- docs/csharp/fundamentals/functional/discards.md | 4 +--- .../snippets/discards/standalone-discard2.cs | 16 ---------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/docs/csharp/fundamentals/functional/discards.md b/docs/csharp/fundamentals/functional/discards.md index c865628178f31..7df3aaf46f043 100644 --- a/docs/csharp/fundamentals/functional/discards.md +++ b/docs/csharp/fundamentals/functional/discards.md @@ -1,7 +1,7 @@ --- title: Discards - unassigned discardable variables description: Describes C#'s support for discards, which are unassigned, discardable variables, and the ways in which discards can be used. -ms.date: 11/14/2023 +ms.date: 02/19/2025 f1_keywords: - "discard_CSharpKeyword" --- @@ -74,8 +74,6 @@ Without assigning the task to a discard, the following code generates a compiler :::code language="csharp" source="snippets/discards/standalone-discard2.cs" ID="VariableIdentifier" ::: - A compiler error for violating type safety. For example: :::code language="csharp" source="snippets/discards/standalone-discard2.cs" ID="VariableTypeInference" ::: -- Compiler error CS0136, "A local or parameter named '\_' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter." For example: - :::code language="csharp" source="snippets/discards/standalone-discard2.cs" ID="CannotRedeclare" ::: ## See also diff --git a/docs/csharp/fundamentals/functional/snippets/discards/standalone-discard2.cs b/docs/csharp/fundamentals/functional/snippets/discards/standalone-discard2.cs index b6bfcd180e810..9a37a90de38c5 100644 --- a/docs/csharp/fundamentals/functional/snippets/discards/standalone-discard2.cs +++ b/docs/csharp/fundamentals/functional/snippets/discards/standalone-discard2.cs @@ -32,21 +32,5 @@ private static bool RoundTrips(int _) // error CS0029: Cannot implicitly convert type 'bool' to 'int' // - // - public void DoSomething(int _) - { - var _ = GetValue(); // Error: cannot declare local _ when one is already in scope - } - // The example displays the following compiler error: - // error CS0136: - // A local or parameter named '_' cannot be declared in this scope - // because that name is used in an enclosing local scope - // to define a local or parameter - // */ - - private int GetValue() - { - return 3; - } } From 14662f813e30137642cca90af8407e3256fc4e7c Mon Sep 17 00:00:00 2001 From: alexwolfmsft <93200798+alexwolfmsft@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:48:49 -0500 Subject: [PATCH 17/20] Update user-assigned and system-assigned managed identity code, overview edits (#44872) * Update identity guidance and instructions --------- Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com> Co-authored-by: Christopher Scott --- docs/azure/sdk/authentication/index.md | 81 +++++--- .../system-assigned-managed-identity.md | 6 +- .../user-assigned-managed-identity.md | 124 ++++++------ .../implement-managed-identity-concepts.md | 11 + .../implement-system-assigned-identity.md | 48 +++++ .../implement-user-assigned-identity.md | 120 +++++++---- .../Program.cs | 85 ++++++++ .../SystemAssignedIdentityClientId.csproj | 17 ++ .../appsettings.Development.json | 8 + .../appsettings.json | 9 + .../user-assigned-managed-identity/Program.cs | 190 ++++++++++++++++++ .../UserAssignedIdentityClientId.csproj | 17 ++ .../appsettings.Development.json | 8 + .../appsettings.json | 9 + 14 files changed, 594 insertions(+), 139 deletions(-) create mode 100644 docs/azure/sdk/includes/implement-managed-identity-concepts.md create mode 100644 docs/azure/sdk/includes/implement-system-assigned-identity.md create mode 100644 docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/Program.cs create mode 100644 docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/SystemAssignedIdentityClientId.csproj create mode 100644 docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/appsettings.Development.json create mode 100644 docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/appsettings.json create mode 100644 docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/Program.cs create mode 100644 docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/UserAssignedIdentityClientId.csproj create mode 100644 docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/appsettings.Development.json create mode 100644 docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/appsettings.json diff --git a/docs/azure/sdk/authentication/index.md b/docs/azure/sdk/authentication/index.md index 5c906957d3ab4..5707fb44788ed 100644 --- a/docs/azure/sdk/authentication/index.md +++ b/docs/azure/sdk/authentication/index.md @@ -6,59 +6,76 @@ ms.custom: devx-track-dotnet, engagement-fy23 ms.date: 08/02/2024 --- -# Authenticate .NET apps to Azure services using the Azure Identity library overview +# Authenticate .NET apps to Azure services using the Azure Identity library -When an app needs to access an Azure resource, the app must be authenticated to Azure. This is true for all apps, whether deployed to Azure, deployed on-premises, or under development on a local developer workstation. This article describes the recommended approaches to authenticate an app to Azure when using the Azure SDK client libraries. +Apps can use the Azure Identity library to authenticate to Microsoft Entra ID, which allows the apps to access Azure services and resources. This authentication requirement applies whether the app is deployed to Azure, hosted on-premises, or running locally on a developer workstation. The sections ahead describe the recommended approaches to authenticate an app to Microsoft Entra ID across different environments when using the Azure SDK client libraries. -## Recommended app authentication approach +## Recommended approach for app authentication -It's recommended that apps use token-based authentication rather than connection strings when authenticating to Azure resources. The [Azure Identity library](/dotnet/api/overview/azure/identity-readme?view=azure-dotnet&preserve-view=true) provides classes that support token-based authentication and allow apps to seamlessly authenticate to Azure resources whether the app is in local development, deployed to Azure, or deployed to an on-premises server. +Token-based authentication via Microsoft Entra ID is the recommended approach for authenticating apps to Azure, instead of using connection strings or key-based options. The [Azure Identity library](/dotnet/api/overview/azure/identity-readme?view=azure-dotnet&preserve-view=true) provides classes that support token-based authentication and allow apps to authenticate to Azure resources whether the app runs locally, on Azure, or on an on-premises server. -The specific type of token-based authentication an app should use to authenticate to Azure resources depends on where the app runs and is shown in the following diagram: +### Advantages of token-based authentication + +Token-based authentication offers the following advantages over connection strings: + +- Token-based authentication ensures only the specific apps intended to access the Azure resource are able to do so, whereas anyone or any app with a connection string can connect to an Azure resource. +- Token-based authentication allows you to further limit Azure resource access to only the specific permissions needed by the app. This follows the [principle of least privilege](https://wikipedia.org/wiki/Principle_of_least_privilege). In contrast, a connection string grants full rights to the Azure resource. +- When using a [managed identity](/entra/identity/managed-identities-azure-resources/overview) for token-based authentication, Azure handles administrative functions for you, so you don't have to worry about tasks like securing or rotating secrets. This makes the app more secure because there's no connection string or application secret that can be compromised. +- The Azure Identity library acquires and manages Microsoft Entra tokens for you. + +Use of connection strings should be limited to scenarios where token-based authentication is not an option, initial proof-of-concept apps, or development prototypes that don't access production or sensitive data. When possible, use the token-based authentication classes available in the Azure Identity library to authenticate to Azure resources. + +## Authentication across different environments + +The specific type of token-based authentication an app should use to authenticate to Azure resources depends on where the app runs. The following diagram provides guidance for different scenarios and environments: :::image type="content" source="../media/dotnet-sdk-auth-strategy.png" alt-text="A diagram showing the recommended token-based authentication strategies for an app depending on where it's running." ::: When an app is: -- **Running locally during development**, the app can authenticate to Azure using either an application service principal for local development or by using the developer's Azure credentials. Each option is discussed in more detail at [authentication during local development](#authentication-during-local-development). -- **Hosted on Azure**, the app should authenticate to Azure resources using a managed identity. This option is discussed in more detail at [authentication in server environments](#authentication-in-server-environments). -- **Hosted and deployed on-premises**, the app should authenticate to Azure resources using an application service principal. This option is discussed in more detail at [authentication in server environments](#authentication-in-server-environments). +- **Hosted on Azure**: The app should authenticate to Azure resources using a managed identity. This option is discussed in more detail at [authentication in server environments](#authentication-for-azure-hosted-apps). +- **Running locally during development**: The app can authenticate to Azure using either an application service principal for local development or by using the developer's Azure credentials. Each option is discussed in more detail at [authentication during local development](#authentication-during-local-development). +- **Hosted on-premises**: The app should authenticate to Azure resources using an application service principal, or a managed identity in the case of Azure Arc. On-premises workflows are discussed in more detail at [authentication in server environments](#authentication-for-apps-hosted-on-premises). -### DefaultAzureCredential +## Authentication for Azure-hosted apps -The [DefaultAzureCredential](#use-defaultazurecredential-in-an-application) class provided by the Azure Identity library allows apps to use different authentication methods depending on the environment in which they're run. This allows apps to be promoted from local development to test environments to production without code changes. You configure the appropriate authentication method for each environment, and `DefaultAzureCredential` will automatically detect and use that authentication method. The use of `DefaultAzureCredential` should be preferred over manually coding conditional logic or feature flags to use different authentication methods in different environments. +When your app is hosted on Azure, it can use managed identities to authenticate to Azure resources without needing to manage any credentials. There are two types of managed identities: user-assigned and system-assigned. -Details about using `DefaultAzureCredential` are covered at [Use `DefaultAzureCredential` in an application](#use-defaultazurecredential-in-an-application). +#### Use a user-assigned managed identity -### Advantages of token-based authentication +A user-assigned managed identity is created as a standalone Azure resource. It can be assigned to one or more Azure resources, allowing those resources to share the same identity and permissions. To authenticate using a user-assigned managed identity, create the identity, assign it to your Azure resource, and then configure your app to use this identity for authentication by specifying its client ID, resource ID, or object ID. -Token-based authentication offers the following advantages over authenticating with connection strings: +> [!div class="nextstepaction"] +> [Authenticate using a user-assigned managed identity](user-assigned-managed-identity.md) -- The token-based authentication methods described below allows you to establish the specific permissions needed by the app on the Azure resource. This follows the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege). In contrast, a connection string grants full rights to the Azure resource. -- Whereas anyone or any app with a connection string can connect to an Azure resource, token-based authentication methods scope access to the resource to only the app(s) intended to access the resource. -- In the case of a managed identity, there's no application secret to store. This makes the app more secure because there's no connection string or application secret that can be compromised. -- The [Azure.Identity](https://www.nuget.org/packages/Azure.Identity) package acquires and manages Microsoft Entra tokens for you. This makes using token-based authentication as easy to use as a connection string. +#### Use a system-assigned managed identity -Use of connection strings should be limited to initial proof-of-concept apps or development prototypes that don't access production or sensitive data. Otherwise, the token-based authentication classes available in the Azure Identity library should always be preferred when authenticating to Azure resources. +A system-assigned managed identity is enabled directly on an Azure resource. The identity is tied to the lifecycle of that resource and is automatically deleted when the resource is deleted. To authenticate using a system-assigned managed identity, enable the identity on your Azure resource and then configure your app to use this identity for authentication. -## Authentication in server environments +> [!div class="nextstepaction"] +> [Authenticate using a system-assigned managed identity](system-assigned-managed-identity.md) -When hosting in a server environment, each app should be assigned a unique *application identity* per environment in which the app is run. In Azure, an application identity is represented by a **service principal**, a special type of *security principal* intended to identify and authenticate apps to Azure. The type of service principal to use for your app depends on where your app is running. +## Authentication during local development -| Authentication method | Description | -|-----------------------|-------------| -| Apps hosted in Azure | [!INCLUDE [sdk-auth-overview-managed-identity](../includes/sdk-auth-overview-managed-identity.md)] | -| Apps hosted outside of Azure
(for example, on-premises apps) | [!INCLUDE [sdk-auth-overview-service-principal](../includes/sdk-auth-overview-service-principal.md)] | +During local development, you can authenticate to Azure resources using your developer credentials or a service principal. This allows you to test your app's authentication logic without deploying it to Azure. -## Authentication during local development +#### Use developer credentials + +You can use your own Azure credentials to authenticate to Azure resources during local development. This is typically done using a development tool, such as Azure CLI or Visual Studio, which can provide your app with the necessary tokens to access Azure services. This method is convenient but should only be used for development purposes. + +> [!div class="nextstepaction"] +> [Authenticate locally using developer credentials](local-development-dev-accounts.md) + +#### Use a service principal + +A service principal is created in a Microsoft Entra tenant to represent an app and be used to authenticate to Azure resources. You can configure your app to use service principal credentials during local development. This method is more secure than using developer credentials and is closer to how your app will authenticate in production. However, it's still less ideal than using a managed identity due to the need for secrets. -When an app is run on a developer's workstation during local development, it must still authenticate to any Azure services used by the app. The two main strategies for authenticating apps to Azure during local development are: +> [!div class="nextstepaction"] +> [Authenticate locally using a service principal](local-development-service-principal.md) -| Authentication method | Description | -|-----------------------|-------------| -| Create dedicated application service principal objects to be used during local development | [!INCLUDE [sdk-auth-overview-dev-service-principals](../includes/sdk-auth-overview-dev-service-principals.md)] | -| Authenticate the app to Azure using the developer's credentials during local development | [!INCLUDE [sdk-auth-overview-dev-accounts](../includes/sdk-auth-overview-dev-accounts.md)] | +## Authentication for apps hosted on-premises -## Use DefaultAzureCredential in an application +For apps hosted on-premises, you can use a service principal to authenticate to Azure resources. This involves creating a service principal in Microsoft Entra ID, assigning it the necessary permissions, and configuring your app to use its credentials. This method allows your on-premises app to securely access Azure services. -[!INCLUDE [Implement DefaultAzureCredential](<../includes/implement-defaultazurecredential.md>)] +> [!div class="nextstepaction"] +> [Authenticate your on-prem app using a service principal](local-development-service-principal.md) diff --git a/docs/azure/sdk/authentication/system-assigned-managed-identity.md b/docs/azure/sdk/authentication/system-assigned-managed-identity.md index 21771077555d2..551feef155910 100644 --- a/docs/azure/sdk/authentication/system-assigned-managed-identity.md +++ b/docs/azure/sdk/authentication/system-assigned-managed-identity.md @@ -32,7 +32,7 @@ You can enable a system-assigned managed identity for an Azure resource using ei 1. On the **Identity** page, toggle the **Status** slider to **On**. 1. Select **Save** to apply your changes. - :::image type="content" source="../media/system-assigned-identity-enable.png" alt-text="A screenshot showing how to enable a system-assigned identity on a container app."::: + :::image type="content" source="../media/system-assigned-identity-enable.png" alt-text="A screenshot showing how to enable a system-assigned managed identity on a container app."::: ### [Azure CLI](#tab/azure-cli) @@ -133,6 +133,4 @@ For information on assigning permissions at the resource or subscription level u --- -## Implement DefaultAzureCredential in your application - -[!INCLUDE [Implement DefaultAzureCredential](<../includes/implement-defaultazurecredential.md>)] +[!INCLUDE [Implement user-assigned managed identity](<../includes/implement-system-assigned-identity.md>)] diff --git a/docs/azure/sdk/authentication/user-assigned-managed-identity.md b/docs/azure/sdk/authentication/user-assigned-managed-identity.md index 33d7e34520787..f6c348bbf6eac 100644 --- a/docs/azure/sdk/authentication/user-assigned-managed-identity.md +++ b/docs/azure/sdk/authentication/user-assigned-managed-identity.md @@ -28,7 +28,7 @@ User-assigned managed identities are created as standalone resources in your Azu 1. In the Azure portal, enter *Managed identities* in the main search bar and select the matching result under the **Services** section. 1. On the **Managed Identities** page, select **+ Create**. - :::image type="content" source="../media/user-assigned-identity-create.png" alt-text="A screenshot showing the page to manage user-assigned identities."::: + :::image type="content" source="../media/user-assigned-identity-create.png" alt-text="A screenshot showing the page to manage user-assigned managed identities."::: 1. On the **Create User Assigned Managed Identity** page, select a subscription, resource group, and region for the user-assigned managed identity, and then provide a name. 1. Select **Review + create** to review and validate your inputs. @@ -77,50 +77,50 @@ A user-assigned managed identity can be associated with one or more Azure resour 1. On the **Add user assigned managed identity** panel, use the **Subscription** dropdown to filter the search results for your identities. Use the **User assigned managed identities** search box to locate the user-assigned managed identity you enabled for the Azure resource hosting your app. 1. Select the identity and choose **Add** at the bottom of the panel to continue. - :::image type="content" source="../media/add-user-assigned-identity-to-app.png" alt-text="A screenshot showing how to associate a user-assigned identity with an app."::: + :::image type="content" source="../media/add-user-assigned-identity-to-app.png" alt-text="A screenshot showing how to associate a user-assigned managed identity with an app."::: ### [Azure CLI](#tab/azure-cli) The Azure CLI provides different commands to assign a user-assigned managed identity to different types of hosting services. -To assign a user-assigned managed identity to a resource such as an Azure App Service web app using the Azure CLI, you'll need the resource ID of the identity. Use the [`az identity show`](/cli/azure/identity?view=azure-cli-latest#az-identity-show) command to retrieve the resource ID: +1. To assign a user-assigned managed identity to a resource such as an Azure App Service web app using the Azure CLI, you'll need the resource ID of the identity. Use the [`az identity show`](/cli/azure/identity?view=azure-cli-latest#az-identity-show) command to retrieve the resource ID: -```azurecli -az identity show \ - --resource-group \ - --name \ - --output json \ - --query id -``` + ```azurecli + az identity show \ + --resource-group \ + --name \ + --output json \ + --query id + ``` -Once you have the resource ID, use the Azure CLI command `az identity assign` command to associate the user-assigned managed identity with different resources, such as the following: +2. Once you have the resource ID, use the Azure CLI command `az identity assign` command to associate the user-assigned managed identity with different resources, such as the following: -For Azure App Service, use the Azure CLI command [`az webapp identity assign`](/cli/azure/webapp/identity?view=azure-cli-latest#az-webapp-identity-assign): + For Azure App Service, use the Azure CLI command [`az webapp identity assign`](/cli/azure/webapp/identity?view=azure-cli-latest#az-webapp-identity-assign): -```azurecli -az webapp identity assign \ - --resource-group \ - --name \ - --identities -``` + ```azurecli + az webapp identity assign \ + --resource-group \ + --name \ + --identities + ``` -For Azure Container Apps, use the Azure CLI command [`az containerapp identity assign`](/cli/azure/containerapp/identity?view=azure-cli-latest#az-containerapp-identity-assign): + For Azure Container Apps, use the Azure CLI command [`az containerapp identity assign`](/cli/azure/containerapp/identity?view=azure-cli-latest#az-containerapp-identity-assign): -```azurecli -az containerapp identity assign \ - --resource-group \ - --name \ - --identities -``` + ```azurecli + az containerapp identity assign \ + --resource-group \ + --name \ + --identities + ``` -For Azure Virtual Machines, use the Azure CLI command [`az vm identity assign`](/cli/azure/vm/identity?view=azure-cli-latest#az-vm-identity-assign): + For Azure Virtual Machines, use the Azure CLI command [`az vm identity assign`](/cli/azure/vm/identity?view=azure-cli-latest#az-vm-identity-assign): -```azurecli -az vm identity assign \ - --resource-group \ - --name \ - --identities -``` + ```azurecli + az vm identity assign \ + --resource-group \ + --name \ + --identities + ``` --- @@ -156,46 +156,44 @@ The following example shows how to assign roles at the resource group scope, sin ### [Azure CLI](#tab/azure-cli) -To assign a role to a user-assigned managed identity using the Azure CLI, you'll need the principal ID of the identity. Use the `az identity show` command to retrieve the resource ID: +1. To assign a role to a user-assigned managed identity using the Azure CLI, you'll need the principal ID of the identity. Use the `az identity show` command to retrieve the principal ID: -```azurecli -az identity show \ - --resource-group \ - --name \ - --output json \ - --query principalId -``` + ```azurecli + az identity show \ + --resource-group \ + --name \ + --output json \ + --query principalId + ``` -Assign a role to a managed identity using the [az role assignment create](/cli/azure/role/assignment#az-role-assignment-create) command: +1. Use the [az role definition list](/cli/azure/role/definition#az-role-definition-list) command to explore which roles a managed identity can be assigned: -```azurecli -az role assignment create \ - --assignee \ - --role \ - --scope -``` + ```azurecli + az role definition list \ + --query "sort_by([].{roleName:roleName, description:description}, &roleName)" \ + --output table + ``` -To explore which roles a managed identity can be assigned, use the [az role definition list](/cli/azure/role/definition#az-role-definition-list) command: +1. Assign a role to a managed identity using the [az role assignment create](/cli/azure/role/assignment#az-role-assignment-create) command: -```azurecli -az role definition list \ - --query "sort_by([].{roleName:roleName, description:description}, &roleName)" \ - --output table -``` + ```azurecli + az role assignment create \ + --assignee \ + --role \ + --scope + ``` -For example, to allow the managed identity with the ID of `99999999-9999-9999-9999-999999999999` read, write, and delete access to Azure Storage blob containers and data to all storage accounts in the *msdocs-dotnet-sdk-auth-example* resource group, assign the application service principal to the *Storage Blob Data Contributor* role using the following command: + For example, to allow the managed identity with the ID of `99999999-9999-9999-9999-999999999999` read, write, and delete access to Azure Storage blob containers and data to all storage accounts in the *msdocs-dotnet-sdk-auth-example* resource group, assign the application service principal to the *Storage Blob Data Contributor* role using the following command: -```azurecli -az role assignment create \ - --assignee 99999999-9999-9999-9999-999999999999 \ - --role "Storage Blob Data Contributor" \ - --scope "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/msdocs-dotnet-sdk-auth-example" -``` + ```azurecli + az role assignment create \ + --assignee 99999999-9999-9999-9999-999999999999 \ + --role "Storage Blob Data Contributor" \ + --scope "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/msdocs-dotnet-sdk-auth-example" + ``` For information on assigning permissions at the resource or subscription level using the Azure CLI, see the article [Assign Azure roles using the Azure CLI](/azure/role-based-access-control/role-assignments-cli). --- -## Implement DefaultAzureCredential in your application - -[!INCLUDE [Implement DefaultAzureCredential](<../includes/implement-user-assigned-identity.md>)] +[!INCLUDE [Implement user-assigned managed identity](<../includes/implement-user-assigned-identity.md>)] diff --git a/docs/azure/sdk/includes/implement-managed-identity-concepts.md b/docs/azure/sdk/includes/implement-managed-identity-concepts.md new file mode 100644 index 0000000000000..0838a299bb6e4 --- /dev/null +++ b/docs/azure/sdk/includes/implement-managed-identity-concepts.md @@ -0,0 +1,11 @@ +--- +ms.topic: include +ms.date: 02/12/2025 +--- + +## Authenticate to Azure services from your app + +The [Azure Identity library](/dotnet/api/azure.identity?view=azure-dotnet&preserve-view=true) provides various *credentials*—implementations of `TokenCredential` adapted to supporting different scenarios and Microsoft Entra authentication flows. Since managed identity is unavailable when running locally, the steps ahead demonstrate which credential to use in which scenario: + +- **Local dev environment**: During **local development only**, use a class called [DefaultAzureCredential](/dotnet/azure/sdk/authentication/credential-chains#defaultazurecredential-overview) for an opinionated, preconfigured chain of credentials. `DefaultAzureCredential` discovers user credentials from your local tooling or IDE, such as the Azure CLI or Visual Studio. It also provides flexibility and convenience for retries, wait times for responses, and support for multiple authentication options. Visit the [Authenticate to Azure services during local development](/dotnet/azure/sdk/authentication/local-development-dev-accounts) article to learn more. +- **Azure-hosted apps**: When your app is running in Azure, use [ManagedIdentityCredential](/dotnet/api/azure.identity.managedidentitycredential?view=azure-dotnet&preserve-view=true) to safely discover the managed identity configured for your app. Specifying this exact type of credential prevents other available credentials from being picked up unexpectedly. diff --git a/docs/azure/sdk/includes/implement-system-assigned-identity.md b/docs/azure/sdk/includes/implement-system-assigned-identity.md new file mode 100644 index 0000000000000..adcb6341d5ee1 --- /dev/null +++ b/docs/azure/sdk/includes/implement-system-assigned-identity.md @@ -0,0 +1,48 @@ +--- +ms.topic: include +ms.date: 02/12/2025 +--- + +[!INCLUDE [implement-managed-identity-concepts](implement-managed-identity-concepts.md)] + +### Implement the code + +Add the [Azure.Identity](/dotnet/api/azure.identity) package. In an ASP.NET Core project, also install the [Microsoft.Extensions.Azure](/dotnet/api/microsoft.extensions.azure) package: + +### [Command Line](#tab/command-line) + +In a terminal of your choice, navigate to the application project directory and run the following commands: + +```dotnetcli +dotnet add package Azure.Identity +dotnet add package Microsoft.Extensions.Azure +``` + +### [NuGet Package Manager](#tab/nuget-package) + +Right-click your project in the Visual Studio **Solution Explorer** window and select **Manage NuGet Packages**. Search for **Azure.Identity**, and install the matching package. Repeat this process for the **Microsoft.Extensions.Azure** package. + +:::image type="content" source="../media/nuget-azure-identity.png" alt-text="Install a package using the package manager."::: + +--- + +Azure services are accessed using specialized client classes from the various Azure SDK client libraries. These classes and your own custom services should be registered for dependency injection so they can be used throughout your app. In `Program.cs`, complete the following steps to configure a client class for dependency injection and token-based authentication: + +1. Include the `Azure.Identity` and `Microsoft.Extensions.Azure` namespaces via `using` directives. +1. Register the Azure service client using the corresponding `Add`-prefixed extension method. +1. Pass an appropriate `TokenCredential` instance to the `UseCredential` method: + - Use `DefaultAzureCredential` when your app is running locally. + - Use `ManagedIdentityCredential` when your app is running in Azure. + +:::code language="csharp" source="../snippets/authentication/system-assigned-managed-identity/Program.cs" id="snippet_MIC_UseCredential"::: + +An alternative to the `UseCredential` method is to provide the credential to the service client directly: + +:::code language="csharp" source="../snippets/authentication/system-assigned-managed-identity/Program.cs" id="snippet_MIC"::: + +--- + +The preceding code behaves differently depending on the environment where it's running: + +- On your local development workstation, `DefaultAzureCredential` looks in the environment variables for an application service principal or at locally installed developer tools, such as Visual Studio, for a set of developer credentials. +- When deployed to Azure, `ManagedIdentityCredential` discovers your managed identity configurations to authenticate to other services automatically. diff --git a/docs/azure/sdk/includes/implement-user-assigned-identity.md b/docs/azure/sdk/includes/implement-user-assigned-identity.md index 9b5b5058a0d78..b7567a661ad4f 100644 --- a/docs/azure/sdk/includes/implement-user-assigned-identity.md +++ b/docs/azure/sdk/includes/implement-user-assigned-identity.md @@ -1,10 +1,13 @@ --- ms.topic: include -ms.date: 08/15/2024 +ms.date: 02/12/2025 --- -[DefaultAzureCredential](../authentication/credential-chains.md#defaultazurecredential-overview) is an opinionated, ordered sequence of mechanisms for authenticating to Microsoft Entra ID. Each authentication mechanism is a class derived from the [TokenCredential](/dotnet/api/azure.core.tokencredential?view=azure-dotnet&preserve-view=true) class and is known as a *credential*. At runtime, `DefaultAzureCredential` attempts to authenticate using the first credential. If that credential fails to acquire an access token, the next credential in the sequence is attempted, and so on, until an access token is successfully obtained. In this way, your app can use different credentials in different environments without writing environment-specific code. -To use `DefaultAzureCredential`, add the [Azure.Identity](/dotnet/api/azure.identity) and optionally the [Microsoft.Extensions.Azure](/dotnet/api/microsoft.extensions.azure) packages to your application: +[!INCLUDE [implement-managed-identity-concepts](implement-managed-identity-concepts.md)] + +### Implement the code + +Add the [Azure.Identity](/dotnet/api/azure.identity) package. In an ASP.NET Core project, also install the [Microsoft.Extensions.Azure](/dotnet/api/microsoft.extensions.azure) package: ### [Command Line](#tab/command-line) @@ -17,53 +20,90 @@ dotnet add package Microsoft.Extensions.Azure ### [NuGet Package Manager](#tab/nuget-package) -Right-click your project in Visual Studio's **Solution Explorer** window and select **Manage NuGet Packages**. Search for **Azure.Identity**, and install the matching package. Repeat this process for the **Microsoft.Extensions.Azure** package. +Right-click your project in the Visual Studio **Solution Explorer** window and select **Manage NuGet Packages**. Search for **Azure.Identity**, and install the matching package. Repeat this process for the **Microsoft.Extensions.Azure** package. :::image type="content" source="../media/nuget-azure-identity.png" alt-text="Install a package using the package manager."::: --- -Azure services are accessed using specialized client classes from the various Azure SDK client libraries. These classes and your own custom services should be registered so they can be accessed via dependency injection throughout your app. In `Program.cs`, complete the following steps to register a client class and `DefaultAzureCredential`: +Azure services are accessed using specialized client classes from the various Azure SDK client libraries. These classes and your own custom services should be registered for dependency injection so they can be used throughout your app. In `Program.cs`, complete the following steps to configure a client class for dependency injection and token-based authentication: 1. Include the `Azure.Identity` and `Microsoft.Extensions.Azure` namespaces via `using` directives. 1. Register the Azure service client using the corresponding `Add`-prefixed extension method. -1. Pass an instance of `DefaultAzureCredential` to the `UseCredential` method. - -> [!NOTE] -> For a user-assigned managed identity, make sure to assign the identity's `clientId` value to the `ManagedIdentityClientId` property on the `DefaultAzureCredentialOptions` object. This enables your code to discover the correct identity to use for authentication while running in azure. - -For example: - -```c# -using Microsoft.Extensions.Azure; -using Azure.Identity; - -builder.Services.AddAzureClients(clientBuilder => -{ - clientBuilder.AddBlobServiceClient( - new Uri("https://.blob.core.windows.net")); - clientBuilder.UseCredential(new DefaultAzureCredential( - new DefaultAzureCredentialOptions() - { - ManagedIdentityClientId = "" - })); -}); -``` +1. Pass an appropriate `TokenCredential` instance to the `UseCredential` method: + - Use `DefaultAzureCredential` when your app is running locally + - Use `ManagedIdentityCredential` when your app is running in Azure and configure either the client ID, resource ID, or object ID. -An alternative to `UseCredential` is to instantiate `DefaultAzureCredential` directly: +## [Client ID](#tab/client-id) -```c# -using Azure.Identity; +The client ID is used to identify a managed identity when configuring applications or services that need to authenticate using that identity. -builder.Services.AddSingleton(_ => - new BlobServiceClient( - new Uri("https://.blob.core.windows.net"), - new DefaultAzureCredential(new DefaultAzureCredentialOptions() - { - ManagedIdentityClientId = "" - }))); -``` +1. Retrieve the client ID assigned to a user-assigned managed identity using the following command: + + ```azurecli + az identity show \ + --resource-group \ + --name \ + --query 'clientId' + ``` + +1. Configure `ManagedIdentityCredential` with the client ID: + + :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ClientId_UseCredential"::: + + An alternative to the `UseCredential` method is to provide the credential to the service client directly: + + :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ClientId"::: + +## [Resource ID](#tab/resource-id) + +The resource ID uniquely identifies the managed identity resource within your Azure subscription using the following structure: + +`/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}` + +Resource IDs can be built by convention, which makes them more convenient when working with a large number of user-assigned managed identities in your environment. + +1. Retrieve the resource ID for a user-assigned managed identity using the following command: + + ```azurecli + az identity show \ + --resource-group \ + --name \ + --query 'id' + ``` + +1. Configure `ManagedIdentityCredential` with the resource ID: + + :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ResourceId_UseCredential"::: + + An alternative to the `UseCredential` method is to provide the credential to the service client directly: + + :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ResourceId"::: + +## [Object ID](#tab/object-id) + +A principal ID is another name for an object ID. + +1. Retrieve the object ID for a user-assigned managed identity using the following command: + + ```azurecli + az identity show \ + --resource-group \ + --name \ + --query 'principalId' + ``` + +1. Configure `ManagedIdentityCredential` with the object ID: + + :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ObjectId_UseCredential"::: + + An alternative to the `UseCredential` method is to provide the credential to the service client directly: + + :::code language="csharp" source="../snippets/authentication/user-assigned-managed-identity/Program.cs" id="snippet_MIC_ObjectId"::: + +--- -When the preceding code runs on your local development workstation, `DefaultAzureCredential` looks in the environment variables for an application service principal or at locally installed developer tools, such as Visual Studio, for a set of developer credentials. Either approach can be used to authenticate the app to Azure resources during local development. +The preceding code behaves differently depending on the environment where it's running: -When deployed to Azure, this same code can also authenticate your app to other Azure resources. `DefaultAzureCredential` can retrieve environment settings and managed identity configurations to authenticate to other services automatically. +- On your local development workstation, `DefaultAzureCredential` looks in the environment variables for an application service principal or at locally installed developer tools, such as Visual Studio, for a set of developer credentials. +- When deployed to Azure, `ManagedIdentityCredential` discovers your managed identity configurations to authenticate to other services automatically. diff --git a/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/Program.cs b/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/Program.cs new file mode 100644 index 0000000000000..7ee24b5450ab2 --- /dev/null +++ b/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/Program.cs @@ -0,0 +1,85 @@ +using Azure.Identity; +using Microsoft.Extensions.Azure; +using Azure.Storage.Blobs; +using Azure.Core; + +var builder = WebApplication.CreateBuilder(args); + +#region snippet_MIC_UseCredential +builder.Services.AddAzureClients(clientBuilder => +{ + clientBuilder.AddBlobServiceClient( + new Uri("https://.blob.core.windows.net")); + + TokenCredential credential = null; + + if (builder.Environment.IsProduction()) + { + // Managed identity token credential discovered when running in Azure environments + credential = new ManagedIdentityCredential(); + } + else + { + // Running locally on dev machine - DO NOT use in production or outside of local dev + credential = new DefaultAzureCredential(); + } + + clientBuilder.UseCredential(credential); +}); +#endregion snippet_MIC_UseCredential + +#region snippet_MIC +TokenCredential credential = null; + +if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) +{ + // Managed identity token credential discovered when running in Azure environments + credential = new ManagedIdentityCredential(); +} +else +{ + // Running locally on dev machine - DO NOT use in production or outside of local dev + credential = new DefaultAzureCredential(); +} + +builder.Services.AddSingleton(_ => + new BlobServiceClient( + new Uri("https://.blob.core.windows.net"), credential)); +#endregion snippet_MIC + +var app = builder.Build(); + +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +var summaries = new[] +{ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" +}; + +app.MapGet("/weatherforecast", () => +{ + var forecast = Enumerable.Range(1, 5).Select(index => + new WeatherForecast + ( + DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + Random.Shared.Next(-20, 55), + summaries[Random.Shared.Next(summaries.Length)] + )) + .ToArray(); + return forecast; +}) +.WithName("GetWeatherForecast") +.WithOpenApi(); + +app.Run(); + +internal record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) +{ + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); +} \ No newline at end of file diff --git a/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/SystemAssignedIdentityClientId.csproj b/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/SystemAssignedIdentityClientId.csproj new file mode 100644 index 0000000000000..94c4ea943ef74 --- /dev/null +++ b/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/SystemAssignedIdentityClientId.csproj @@ -0,0 +1,17 @@ + + + + net9.0 + enable + enable + + + + + + + + + + + diff --git a/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/appsettings.Development.json b/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/appsettings.Development.json new file mode 100644 index 0000000000000..0c208ae9181e5 --- /dev/null +++ b/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/appsettings.json b/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/appsettings.json new file mode 100644 index 0000000000000..10f68b8c8b4f7 --- /dev/null +++ b/docs/azure/sdk/snippets/authentication/system-assigned-managed-identity/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/Program.cs b/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/Program.cs new file mode 100644 index 0000000000000..3a2211ece4eda --- /dev/null +++ b/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/Program.cs @@ -0,0 +1,190 @@ +using Azure.Identity; +using Microsoft.Extensions.Azure; +using Azure.Storage.Blobs; +using Azure.Core; + +var builder = WebApplication.CreateBuilder(args); + +// Registration options +// registerUsingClientId(builder); +// registerUsingObjectId(builder); +// registerUsingResourceId(builder); + +var app = builder.Build(); + +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +var summaries = new[] +{ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" +}; + +app.MapGet("/weatherforecast", () => +{ + var forecast = Enumerable.Range(1, 5).Select(index => + new WeatherForecast + ( + DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + Random.Shared.Next(-20, 55), + summaries[Random.Shared.Next(summaries.Length)] + )) + .ToArray(); + return forecast; +}) +.WithName("GetWeatherForecast") +.WithOpenApi(); + +app.Run(); + +void registerUsingClientId(WebApplicationBuilder builder) +{ + #region snippet_MIC_ClientId_UseCredential + builder.Services.AddAzureClients(clientBuilder => + { + clientBuilder.AddBlobServiceClient( + new Uri("https://.blob.core.windows.net")); + + TokenCredential credential = null; + + if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) + { + // Managed identity token credential discovered when running in Azure environments + credential = new ManagedIdentityCredential( + ManagedIdentityId.FromUserAssignedClientId("")); + } + else + { + // Running locally on dev machine - DO NOT use in production or outside of local dev + credential = new DefaultAzureCredential(); + } + + clientBuilder.UseCredential(credential); + }); + #endregion snippet_MIC_ClientId_UseCredential + + #region snippet_MIC_ClientId + TokenCredential credential = null; + + if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) + { + // Managed identity token credential discovered when running in Azure environments + credential = new ManagedIdentityCredential( + ManagedIdentityId.FromUserAssignedClientId("")); + } + else + { + // Running locally on dev machine - DO NOT use in production or outside of local dev + credential = new DefaultAzureCredential(); + } + + builder.Services.AddSingleton(_ => + new BlobServiceClient( + new Uri("https://.blob.core.windows.net"), credential)); + #endregion snippet_MIC_ClientId +} + +void registerUsingObjectId(WebApplicationBuilder builder) +{ + #region snippet_MIC_ObjectId_UseCredential + builder.Services.AddAzureClients(clientBuilder => + { + clientBuilder.AddBlobServiceClient( + new Uri("https://.blob.core.windows.net")); + + TokenCredential credential = null; + + if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) + { + // Managed identity token credential discovered when running in Azure environments + credential = new ManagedIdentityCredential( + ManagedIdentityId.FromUserAssignedObjectId("")); + } + else + { + // Running locally on dev machine - DO NOT use in production or outside of local dev + credential = new DefaultAzureCredential(); + } + + clientBuilder.UseCredential(credential); + }); + #endregion snippet_MIC_ObjectId_UseCredential + + #region snippet_MIC_ObjectId + TokenCredential credential = null; + + if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) + { + // Managed identity token credential discovered when running in Azure environments + credential = new ManagedIdentityCredential( + ManagedIdentityId.FromUserAssignedObjectId("")); + } + else + { + // Running locally on dev machine - DO NOT use in production or outside of local dev + credential = new DefaultAzureCredential(); + } + + builder.Services.AddSingleton(_ => + new BlobServiceClient( + new Uri("https://.blob.core.windows.net"), credential)); + #endregion snippet_MIC_ObjectId +} + + +void registerUsingResourceId(WebApplicationBuilder builder) +{ + #region snippet_MIC_ResourceId_UseCredential + builder.Services.AddAzureClients(clientBuilder => + { + clientBuilder.AddBlobServiceClient( + new Uri("https://.blob.core.windows.net")); + + TokenCredential credential = null; + + if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) + { + // Managed identity token credential discovered when running in Azure environments + credential = new ManagedIdentityCredential( + ManagedIdentityId.FromUserAssignedResourceId(new ResourceIdentifier(""))); + } + else + { + // Running locally on dev machine - DO NOT use in production or outside of local dev + credential = new DefaultAzureCredential(); + } + + clientBuilder.UseCredential(credential); + }); + #endregion snippet_MIC_ResourceId_UseCredential + + #region snippet_MIC_ResourceId + TokenCredential credential = null; + + if (builder.Environment.IsProduction() || builder.Environment.IsStaging()) + { + // Managed identity token credential discovered when running in Azure environments + credential = new ManagedIdentityCredential( + ManagedIdentityId.FromUserAssignedResourceId(new ResourceIdentifier(""))); + } + else + { + // Running locally on dev machine - DO NOT use in production or outside of local dev + credential = new DefaultAzureCredential(); + } + + builder.Services.AddSingleton(_ => + new BlobServiceClient( + new Uri("https://.blob.core.windows.net"), credential)); + #endregion snippet_MIC_ResourceId +} + +internal record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) +{ + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); +} \ No newline at end of file diff --git a/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/UserAssignedIdentityClientId.csproj b/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/UserAssignedIdentityClientId.csproj new file mode 100644 index 0000000000000..94c4ea943ef74 --- /dev/null +++ b/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/UserAssignedIdentityClientId.csproj @@ -0,0 +1,17 @@ + + + + net9.0 + enable + enable + + + + + + + + + + + diff --git a/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/appsettings.Development.json b/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/appsettings.Development.json new file mode 100644 index 0000000000000..0c208ae9181e5 --- /dev/null +++ b/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/appsettings.json b/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/appsettings.json new file mode 100644 index 0000000000000..10f68b8c8b4f7 --- /dev/null +++ b/docs/azure/sdk/snippets/authentication/user-assigned-managed-identity/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} From 33c235c09ff1c89046232a87066a3affb09390a9 Mon Sep 17 00:00:00 2001 From: Scott Addie <10702007+scottaddie@users.noreply.github.com> Date: Wed, 19 Feb 2025 13:23:54 -0600 Subject: [PATCH 18/20] Convert list to tabs in config-based authN doc (#44967) * Convert list to tabs * Update docs/azure/sdk/authentication/create-token-credentials-from-configuration.md Co-authored-by: alexwolfmsft <93200798+alexwolfmsft@users.noreply.github.com> * Fix Markdownlint error --------- Co-authored-by: alexwolfmsft <93200798+alexwolfmsft@users.noreply.github.com> --- ...te-token-credentials-from-configuration.md | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/docs/azure/sdk/authentication/create-token-credentials-from-configuration.md b/docs/azure/sdk/authentication/create-token-credentials-from-configuration.md index 80deace607afc..34b08494f1277 100644 --- a/docs/azure/sdk/authentication/create-token-credentials-from-configuration.md +++ b/docs/azure/sdk/authentication/create-token-credentials-from-configuration.md @@ -3,7 +3,7 @@ title: Create token credentials from configuration description: This article describes how to create Microsoft Entra token credentials from configuration files. ms.topic: how-to ms.custom: devx-track-dotnet, engagement-fy23 -ms.date: 11/05/2024 +ms.date: 02/19/2025 --- # Create Microsoft Entra credential types using configuration files @@ -68,39 +68,42 @@ You can create both user-assigned and system-assigned managed identities using c #### User-assigned managed identities -A user-assigned managed identity can be used by providing a client ID, resource ID, or object ID: +A user-assigned managed identity can be used by providing a client ID, resource ID, or object ID. -- **Client ID:** +## [Client ID](#tab/client-id) - ```json - { - "credential": "managedidentity", - "clientId": "" - } - ``` +```json +{ + "credential": "managedidentity", + "clientId": "" +} +``` -- **Resource ID:** +## [Resource ID](#tab/resource-id) - ```json - { - "credential": "managedidentity", - "managedIdentityResourceId": "" - } - ``` +```json +{ + "credential": "managedidentity", + "managedIdentityResourceId": "" +} +``` - The resource ID takes the form `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}`. +The resource ID takes the form: +`/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}` -- **Object ID:** +## [Object ID](#tab/object-id) + +```json +{ + "credential": "managedidentity", + "managedIdentityObjectId": "" +} +``` - ```json - { - "credential": "managedidentity", - "managedIdentityObjectId": "" - } - ``` +> [!IMPORTANT] +> The `managedIdentityObjectId` JSON property is supported in `Microsoft.Extensions.Azure` versions 1.8.0 and later. - > [!IMPORTANT] - > The `managedIdentityObjectId` JSON property is supported in `Microsoft.Extensions.Azure` versions 1.8.0 and later. +--- #### System-assigned managed identities From 1175f1dbc8c601b7b7043a89895e63b68a3ba011 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Wed, 19 Feb 2025 14:48:25 -0500 Subject: [PATCH 19/20] Explain `///` comments without elements (#44968) * Explain `///` comments without elements Fixes #44161 Yes, roslyn interprets these comments and exports them to the XML file. However, the text isn't in a child XML element, and won't be interpreted by other tools. * build warning --- .../csharp/language-reference/xmldoc/index.md | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/csharp/language-reference/xmldoc/index.md b/docs/csharp/language-reference/xmldoc/index.md index d9c564e74e6d1..5d9fab635f364 100644 --- a/docs/csharp/language-reference/xmldoc/index.md +++ b/docs/csharp/language-reference/xmldoc/index.md @@ -1,7 +1,7 @@ --- title: "Documentation comments - document APIs using /// comments" description: Learn about documentation comments. You can create documentation for your code by including XML elements in special comment fields. You can use other tools to build documentation layouts from comments. -ms.date: 06/14/2023 +ms.date: 02/19/2025 f1_keywords: - "cs.xml" helpviewer_keywords: @@ -11,12 +11,11 @@ helpviewer_keywords: - "C# source code files" - "C# language, XML code comments" - "XML documentation comments [C#]" -ms.assetid: 803b7f7b-7428-4725-b5db-9a6cff273199 --- # Documentation comments -C# source files can have structured comments that produce API documentation for the types defined in those files. The C# compiler produces an *XML* file that contains structured data representing the comments and the API signatures. Other tools can process that XML output to create human-readable documentation in the form of web pages or PDF files, for example. +C# source files can include structured comments that produce API documentation for the types defined in those files. The C# compiler produces an *XML* file that contains structured data representing the comments and the API signatures. Other tools can process that XML output to create human-readable documentation in the form of web pages or PDF files, for example. This process provides many advantages for you to add API documentation in your code: @@ -26,7 +25,7 @@ This process provides many advantages for you to add API documentation in your c Tools like Visual Studio provide IntelliSense for many common XML elements used in documentation comments. -This article covers these topics: +This article covers these articles: - Documentation comments and XML file generation - Tags validated by the C# compiler and Visual Studio @@ -49,14 +48,14 @@ You set either the [**GenerateDocumentationFile**](../../../core/project-sdk/msb The use of XML doc comments requires delimiters that indicate where a documentation comment begins and ends. You use the following delimiters with the XML documentation tags: -- `///` Single-line delimiter: The documentation examples and C# project templates use this form. If there's white space following the delimiter, it isn't included in the XML output. +- `///` Single-line delimiter: The documentation examples and C# project templates use this form. If white space follows the delimiter, it isn't included in the XML output. > [!NOTE] > Visual Studio automatically inserts the `` and `` tags and positions your cursor within these tags after you type the `///` delimiter in the code editor. You can turn this feature on or off in the [Options dialog box](/visualstudio/ide/reference/options-text-editor-csharp-advanced). - `/** */` Multiline delimiters: The `/** */` delimiters have the following formatting rules: - On the line that contains the `/**` delimiter, if the rest of the line is white space, the line isn't processed for comments. If the first character after the `/**` delimiter is white space, that white-space character is ignored and the rest of the line is processed. Otherwise, the entire text of the line after the `/**` delimiter is processed as part of the comment. - On the line that contains the `*/` delimiter, if there's only white space up to the `*/` delimiter, that line is ignored. Otherwise, the text on the line up to the `*/` delimiter is processed as part of the comment. - For the lines after the one that begins with the `/**` delimiter, the compiler looks for a common pattern at the beginning of each line. The pattern can consist of optional white space and/or an asterisk (`*`), followed by more optional white space. If the compiler finds a common pattern at the beginning of each line that doesn't begin with the `/**` delimiter or end with the `*/` delimiter, it ignores that pattern for each line. - - The only part of the following comment that's processed is the line that begins with ``. The three tag formats produce the same comments. + - The only part of the following comment processed is the line that begins with ``. The three tag formats produce the same comments. ```csharp /** text */ @@ -100,10 +99,10 @@ The use of XML doc comments requires delimiters that indicate where a documentat ``` -To refer to XML elements (for example, your function processes specific XML elements that you want to describe in an XML documentation comment), you can use the standard quoting mechanism (`<` and `>`). To refer to generic identifiers in code reference (`cref`) elements, you can use either the escape characters (for example, `cref="List<T>"`) or braces (`cref="List{T}"`). As a special case, the compiler parses the braces as angle brackets to make the documentation comment less cumbersome to the author when referring to generic identifiers. +To refer to XML elements (for example, your function processes specific XML elements that you want to describe in an XML documentation comment), you can use the standard quoting mechanism (`<` and `>`). To refer to generic identifiers in code reference (`cref`) elements, you can use either the escape characters (for example, `cref="List<T>"`) or braces (`cref="List{T}"`). As a special case, the compiler parses the braces as angle brackets to make the documentation comment less cumbersome to the author when referring to generic identifiers. > [!NOTE] -> The XML documentation comments are not metadata; they are not included in the compiled assembly and therefore they are not accessible through reflection. +> If you write comments using the single line XML comment delimiter, `///`, but don't include any tags, the compiler adds the text of those comments to the XML output file. However, the output doesn't include XML elements such as ``. Most tools that consume XML comments (including Visual Studio intellisense) don't read these comments. ## Tools that accept XML documentation input @@ -113,6 +112,9 @@ The following tools create output from XML comments: - [Sandcastle](https://github.com/EWSoftware/SHFB): The *Sandcastle tools* create help files for managed class libraries containing both conceptual and API reference pages. The Sandcastle tools are command-line based and have no GUI front-end, project management features, or automated build process. The Sandcastle Help File Builder provides standalone GUI and command-line-based tools to build a help file in an automated fashion. A Visual Studio integration package is also available for it so that help projects can be created and managed entirely from within Visual Studio. - [Doxygen](https://github.com/doxygen/doxygen): *Doxygen* generates an online documentation browser (in HTML) or an offline reference manual (in LaTeX) from a set of documented source files. There's also support for generating output in RTF (MS Word), PostScript, hyperlinked PDF, compressed HTML, DocBook, and Unix manual pages. You can configure Doxygen to extract the code structure from undocumented source files. +> [!NOTE] +> The XML documentation comments aren't metadata; they aren't included in the compiled assembly and therefore they aren't accessible through reflection. + ### ID strings Each type or member is stored in an element in the output XML file. Each of those elements has a unique ID string that identifies the type or member. The ID string must account for operators, parameters, return values, generic type parameters, `ref`, `in`, and `out` parameters. To encode all those potential elements, the compiler follows clearly defined rules for generating the ID strings. Programs that process the XML file use the ID string to identify the corresponding .NET metadata or reflection item that the documentation applies to. @@ -132,7 +134,7 @@ The compiler observes the following rules when it generates the ID strings: | `E` | event | | | `!` | error string | The rest of the string provides information about the error. The C# compiler generates error information for links that can't be resolved. | -- The second part of the string is the fully qualified name of the item, starting at the root of the namespace. The name of the item, its enclosing type(s), and namespace are separated by periods. If the name of the item itself has periods, they're replaced with the hash-sign ('#'). It's assumed that no item has a hash-sign directly in its name. For example, the fully qualified name of the String constructor is "System.String.#ctor". +- The second part of the string is the fully qualified name of the item, starting at the root of the namespace. The name of the item, its enclosing type(s), and namespace are separated by periods. If the name of the item itself has periods, they're replaced with the hash-sign ('#'). The grammar assumes that no item has a hash-sign directly in its name. For example, the fully qualified name of the String constructor is "System.String.#ctor". - For properties and methods, the parameter list enclosed in parentheses follows. If there are no parameters, no parentheses are present. The parameters are separated by commas. The encoding of each parameter follows directly how it's encoded in a .NET signature (See for definitions of the all caps elements in the following list): - Base types. Regular types (`ELEMENT_TYPE_CLASS` or `ELEMENT_TYPE_VALUETYPE`) are represented as the fully qualified name of the type. - Intrinsic types (for example, `ELEMENT_TYPE_I4`, `ELEMENT_TYPE_OBJECT`, `ELEMENT_TYPE_STRING`, `ELEMENT_TYPE_TYPEDBYREF`, and `ELEMENT_TYPE_VOID`) are represented as the fully qualified name of the corresponding full type. For example, `System.Int32` or `System.TypedReference`. @@ -140,7 +142,7 @@ The compiler observes the following rules when it generates the ID strings: - `ELEMENT_TYPE_BYREF` is represented as a '\@' following the modified type. - `ELEMENT_TYPE_CMOD_OPT` is represented as a '!' and the fully qualified name of the modifier class, following the modified type. - `ELEMENT_TYPE_SZARRAY` is represented as "[]" following the element type of the array. - - `ELEMENT_TYPE_ARRAY` is represented as [*lower bound*:`size`,*lower bound*:`size`] where the number of commas is the rank - 1, and the lower bounds and size of each dimension, if known, are represented in decimal. If a lower bound or size isn't specified, it's omitted. If the lower bound and size for a particular dimension is omitted, the ':' is omitted as well. For example, a two-dimensional array with 1 as the lower bounds and unspecified sizes is [1:,1:]. + - `ELEMENT_TYPE_ARRAY` is represented as [*lower bound*:`size`,*lower bound*:`size`] where the number of commas is the rank - 1, and the lower bounds and size of each dimension, if known, are represented in decimal. The lower bound and size are omitted if they aren't specified. If the lower bound and size for a particular dimension is omitted, the ':' is omitted as well. For example, a two-dimensional array with 1 as the lower bounds and unspecified sizes is [1:,1:]. - For conversion operators only (`op_Implicit` and `op_Explicit`), the return value of the method is encoded as a `~` followed by the return type. For example: `` is the tag for the cast operator `public static explicit operator int (decimal value);` declared in the `System.Decimal` class. - For generic types, the name of the type is followed by a backtick and then a number that indicates the number of generic type parameters. For example: From d9cf6dbc0552f5763e4d20f41dff6891c0bb4684 Mon Sep 17 00:00:00 2001 From: Noah Falk Date: Wed, 19 Feb 2025 22:43:13 -0800 Subject: [PATCH 20/20] Add LLDB docs (#44902) * Add LLDB docs Adding docs that show how to install and use LLDB and dotnet debugger extensions together. We've long had docs about the extensions themselves, but learn.microsoft.com had nothing that showed how to put it together with LLDB. Some of the LLDB info comes from https://github.com/dotnet/diagnostics/blob/main/documentation/lldb/linux-instructions.md. I left out distros where users need to build LLDB, but we could add that in the future if needed. Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/core/diagnostics/debugger-extensions.md | 12 +- docs/core/diagnostics/lldb-linux.md | 185 +++++++++++++++++++ docs/navigate/tools-diagnostics/toc.yml | 2 + 3 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 docs/core/diagnostics/lldb-linux.md diff --git a/docs/core/diagnostics/debugger-extensions.md b/docs/core/diagnostics/debugger-extensions.md index 5c05635a2c3ae..67b64fa72cca7 100644 --- a/docs/core/diagnostics/debugger-extensions.md +++ b/docs/core/diagnostics/debugger-extensions.md @@ -11,7 +11,7 @@ helpviewer_keywords: # .NET debugger extensions -The .NET debugger extensions let you view information about code that's running inside the .NET runtime, both on live processes and dumps. The extensions are preinstalled with [Windbg](/windows-hardware/drivers/debugger/debugger-download-tools), and can be [downloaded](dotnet-debugger-extensions.md) for use with LLDB. You can use the .NET debugger extensions to: +The .NET debugger extensions let you view information about code that's running inside the .NET runtime, both on live processes and dumps. The extensions work with [Windbg](/windows-hardware/drivers/debugger/debugger-download-tools) and [LLDB](https://lldb.llvm.org/). You can use the .NET debugger extensions to: - Collect information about the managed heap. - Look for heap corruptions. @@ -20,6 +20,16 @@ The .NET debugger extensions let you view information about code that's running The .NET debugger extensions include commands from the existing [dotnet-sos](dotnet-sos.md) tool as well as new commands. A limited set of commands are also now supported for the Native AOT runtime. +## Install + +### Windows + +Install Windbg from the [Windows SDK](/windows-hardware/drivers/debugger/debugger-download-tools). Windbg versions 10.0.18317.1001 and later automatically load the extensions from the Microsoft extension gallery. + +### Linux + +To install LLDB and the .NET debugger extensions, see [Install and use LLDB on Linux](lldb-linux.md). + ## Syntax Under windbg: `![command] [options]` diff --git a/docs/core/diagnostics/lldb-linux.md b/docs/core/diagnostics/lldb-linux.md new file mode 100644 index 0000000000000..a7d7e73aca8a6 --- /dev/null +++ b/docs/core/diagnostics/lldb-linux.md @@ -0,0 +1,185 @@ +--- +title: Install and use LLDB on Linux +description: Instructions for installing and using LLDB to debug a .NET application on Linux +ms.date: 02/13/2025 +--- + +# Install and use LLDB on Linux + +[LLDB](https://lldb.llvm.org/) is a powerful, open-source debugger that's part of the LLVM project. When you're debugging .NET applications on Linux, you can use LLDB with the [.NET debugger extensions](debugger-extensions.md) to inspect managed application state. LLDB can work with both dumps and live processes. + +## Install + +### Install LLDB + +The .NET debugger extensions require at least LLDB 3.9 but version 10.0 or later is recommended. The following sections provide instructions for installing LLDB on popular Linux distributions. + +#### AzureLinux 2.0 and later + +To install the LLDB packages: + +```console + sudo tdnf install lldb +``` + +To launch LLDB: + +```console + lldb +``` + +#### Ubuntu 20.04 and later + +To install the LLDB packages: + +```console + sudo apt-get update + sudo apt-get install lldb +``` + +To launch LLDB: + +```console + lldb +``` + +#### Alpine 3.9 and later + +To install the LLDB packages: + +```console + apk update + apk add lldb +``` + +To launch LLDB: + +```console + lldb +``` + +#### Debian 9 and later + +To install the LLDB packages: + +```console + sudo apt-get install lldb-3.9 python-lldb-3.9 +``` + +To launch LLDB: + +```console + lldb-3.9 +``` + +#### Fedora 29 and later + +To install the LLDB packages: + +```console + sudo dnf install lldb python2-lldb +``` + +To launch LLDB: + +```console + lldb +``` + +#### RHEL 7.5 and later + +See [LLDB](https://access.redhat.com/documentation/en-us/red_hat_developer_tools/1/html/using_llvm_12.0.1_toolset/assembly_llvm#proc_installing-comp-toolset_assembly_llvm) on RedHat's website. + +### Install the .NET debugger extensions + +Install the .NET debugger extensions using the [dotnet-debugger-extensions](dotnet-debugger-extensions.md) install tool. The installer creates a `.lldbinit` file in your home directory that automatically loads the extensions when you start LLDB. + +> [!NOTE] +> The version of the debugger extensions does not need to match the version of the .NET runtime. We recommend using the latest extension version. + +> [!NOTE] +> Installing with [dotnet-sos](dotnet-sos.md) instead of [dotnet-debugger-extensions](dotnet-debugger-extensions.md) also works, but only installs a subset of the extension commands. + +## Getting started with LLDB + +This example shows using LLDB to attach to a pre-existing .NET application (`dotnet webapp.dll`) that's running on the machine. + +1. Use the `ps` command to find the process ID (PID) of the .NET application you want to debug. + + ```console + $ ps -ao pid,cmd + PID CMD + 697 -bash + 229233 dotnet webapp.dll + 229696 ps -ao pid,cmd + ... other processes omitted for brevity ... + ``` + + In this case, the PID of the .NET application to debug is 229233. + +1. Run LLDB and attach to the process. + + Launch LLDB using the appropriate command for your distribution (shown previously in the [Install LLDB](#install-lldb) section). Often this is just `lldb`, but some distros require a version number in the name, like `lldb-3.9`. + + ```console + $ lldb + Current symbol store settings: + -> Cache: /home/username/.dotnet/symbolcache + -> Server: https://msdl.microsoft.com/download/symbols/ Timeout: 4 RetryCount: 0 + (lldb) + ``` + +1. At the `(lldb)` prompt, run the process attach command. + + ```console + (lldb) process attach --pid 229233 + Process 229233 stopped + * thread #1, name = 'dotnet', stop reason = signal SIGSTOP + frame #0: 0x00007f2ca7c11117 libc.so.6`___lldb_unnamed_symbol3457 + 231 + libc.so.6`___lldb_unnamed_symbol3457: + -> 0x7f2ca7c11117 <+231>: movl %r12d, %edi + 0x7f2ca7c1111a <+234>: movq %rax, %rbx + 0x7f2ca7c1111d <+237>: callq 0x7f2ca7c10a60 ; ___lldb_unnamed_symbol3445 + 0x7f2ca7c11122 <+242>: jmp 0x7f2ca7c11089 ; <+89> + thread #2, name = 'dotnet-ust', stop reason = signal SIGSTOP + frame #0: 0x00007f2ca7c9e88d libc.so.6`syscall + 29 + libc.so.6`syscall: + ... more output omitted ... + ``` + + The debugger is now attached and you can use both built-in LLDB commands and .NET debugger extension commands to inspect the process state. + + > [!NOTE] + > If LLDB outputs 'error: attach failed: Operation not permitted', this means you don't have sufficient privileges to debug. The most reliable way to resolve this is to quit LLDB and restart using sudo. When elevated LLDB won't automatically run the normal .lldbinit script, you can do so explicitly by using the `--source` argument on the command line: `sudo lldb --source ~/.lldbinit`. + +1. Run an example command + + The clrstack command displays the stack trace for .NET code on the currently selected thread. + + ```console + (lldb) clrstack + OS Thread Id: 0x497 (1) + Child SP IP Call Site + 00007FFD0877D260 00007f2ca7c11117 [HelperMethodFrame_1OBJ: 00007ffd0877d260] + System.Threading.Monitor.ObjWait(Int32, System.Object) + 00007FFD0877D390 00007F2C2864AA0E System.Threading.Monitor.Wait(System.Object, Int32) + 00007FFD0877D3A0 00007F2C28654625 System.Threading.ManualResetEventSlim.Wait(Int32, + System.Threading.CancellationToken) + 00007FFD0877D420 00007F2C286684A8 System.Threading.Tasks.Task.SpinThenBlockingWait(Int32, + System.Threading.CancellationToken) + 00007FFD0877D480 00007F2C2866832D System.Threading.Tasks.Task.InternalWaitCore(Int32, + System.Threading.CancellationToken) + 00007FFD0877D4D0 00007F2C286B2508 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task, System.Threading.Tasks.ConfigureAwaitOptions) + 00007FFD0877D4F0 00007F2C29281B45 Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(Microsoft.Extensions.Hosting.IHost) + 00007FFD0877D510 00007F2C29121A7D Program.
$(System.String[]) [/home/username/app/Program.cs @ 25] + ``` + +## Next steps + +To learn more about the commands available when debugging .NET applications with LLDB, see the documentation for the [.NET debugger extensions](debugger-extensions.md) and [LLDB](https://lldb.llvm.org/). + +## See also + +- [LLDB](https://lldb.llvm.org/) for more information about the LLDB debugger. +- [.NET debugger extensions](debugger-extensions.md) for a reference of the extension commands available. +- [dotnet-symbol](dotnet-symbol.md) for more details on installing and using the symbol download tool. diff --git a/docs/navigate/tools-diagnostics/toc.yml b/docs/navigate/tools-diagnostics/toc.yml index 85fa030eb630d..deb2b063f6d3d 100644 --- a/docs/navigate/tools-diagnostics/toc.yml +++ b/docs/navigate/tools-diagnostics/toc.yml @@ -487,6 +487,8 @@ items: href: ../../core/diagnostics/collect-dumps-crash.md - name: Frequently asked questions href: ../../core/diagnostics/faq-dumps.yml + - name: Install and use LLDB on Linux + href: ../../core/diagnostics/lldb-linux.md - name: Symbols href: ../../core/diagnostics/symbols.md - name: EventPipe