Skip to content

Commit 47f9f77

Browse files
[Identity] Deprecate attributes related to SharedTokenCacheCredential (Azure#51645)
* Deprecate `VisualStudioCodeTenantId` and `SharedTokenCacheUsername` attributes * Export API * Update sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredentialOptions.cs Co-authored-by: Scott Addie <[email protected]> * Export API * Update changelog * Apply suggestions from code review Co-authored-by: Scott Addie <[email protected]> * Update changelog --------- Co-authored-by: Scott Addie <[email protected]>
1 parent a7c6c66 commit 47f9f77

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

sdk/identity/Azure.Identity/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
- `SharedTokenCacheCredential` class is marked as `[Obsolete]` and `[EditorBrowsable(EditorBrowsableState.Never)]`
1313
- `SharedTokenCacheCredentialOptions` class is marked as `[Obsolete]` and `[EditorBrowsable(EditorBrowsableState.Never)]`
1414
- `DefaultAzureCredentialOptions.ExcludeSharedTokenCacheCredential` property is marked as `[Obsolete]` and `[EditorBrowsable(EditorBrowsableState.Never)]`
15+
- `SharedTokenCacheUsername` property is marked as `[Obsolete]` and `[EditorBrowsable(EditorBrowsableState.Never)]`
1516
- `SharedTokenCacheCredential` is no longer included in the `DefaultAzureCredential` authentication flow
1617

1718
### Bugs Fixed
1819

1920
### Other Changes
2021

22+
- Added the `EditorBrowsable(Never)` attribute to property `VisualStudioCodeTenantId` as `TenantId` is preferred. The `VisualStudioCodeTenantId` property exists only to provide backwards compatibility.
23+
2124
## 1.15.0-beta.1 (2025-07-17)
2225

2326
### Features Added

sdk/identity/Azure.Identity/api/Azure.Identity.net8.0.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,11 @@ public DefaultAzureCredentialOptions() { }
218218
public Azure.Core.ResourceIdentifier ManagedIdentityResourceId { get { throw null; } set { } }
219219
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
220220
public string SharedTokenCacheTenantId { get { throw null; } set { } }
221+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
222+
[System.ObsoleteAttribute("SharedTokenCacheCredential is deprecated. Consider using other dev tool credentials, such as VisualStudioCredential.")]
221223
public string SharedTokenCacheUsername { get { throw null; } set { } }
222224
public string TenantId { get { throw null; } set { } }
225+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
223226
public string VisualStudioCodeTenantId { get { throw null; } set { } }
224227
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
225228
public string VisualStudioTenantId { get { throw null; } set { } }

sdk/identity/Azure.Identity/api/Azure.Identity.netstandard2.0.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,11 @@ public DefaultAzureCredentialOptions() { }
215215
public Azure.Core.ResourceIdentifier ManagedIdentityResourceId { get { throw null; } set { } }
216216
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
217217
public string SharedTokenCacheTenantId { get { throw null; } set { } }
218+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
219+
[System.ObsoleteAttribute("SharedTokenCacheCredential is deprecated. Consider using other dev tool credentials, such as VisualStudioCredential.")]
218220
public string SharedTokenCacheUsername { get { throw null; } set { } }
219221
public string TenantId { get { throw null; } set { } }
222+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
220223
public string VisualStudioCodeTenantId { get { throw null; } set { } }
221224
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
222225
public string VisualStudioTenantId { get { throw null; } set { } }

sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredentialOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public string VisualStudioTenantId
150150
/// <see cref="VisualStudioCodeCredential"/>. The default is null and will authenticate users to their default tenant.
151151
/// The value can also be set by setting the environment variable AZURE_TENANT_ID.
152152
/// </summary>
153+
[EditorBrowsable(EditorBrowsableState.Never)]
153154
public string VisualStudioCodeTenantId
154155
{
155156
get => _visualStudioCodeTenantId.Value;
@@ -183,6 +184,8 @@ public string VisualStudioCodeTenantId
183184
/// the cache, the SharedTokenCacheCredential won't be used for authentication.
184185
/// Defaults to the value of environment variable <c>AZURE_USERNAME</c>.
185186
/// </remarks>
187+
[Obsolete("SharedTokenCacheCredential is deprecated. Consider using other dev tool credentials, such as VisualStudioCredential.")]
188+
[EditorBrowsable(EditorBrowsableState.Never)]
186189
public string SharedTokenCacheUsername { get; set; } = EnvironmentVariables.Username;
187190

188191
/// <summary>
@@ -302,7 +305,9 @@ public string VisualStudioCodeTenantId
302305
dacClone._sharedTokenCacheTenantId = _sharedTokenCacheTenantId;
303306
dacClone._visualStudioTenantId = _visualStudioTenantId;
304307
dacClone._visualStudioCodeTenantId = _visualStudioCodeTenantId;
308+
#pragma warning disable CS0618 // Type or member is obsolete
305309
dacClone.SharedTokenCacheUsername = SharedTokenCacheUsername;
310+
#pragma warning restore CS0618 // Type or member is obsolete
306311
dacClone.InteractiveBrowserCredentialClientId = InteractiveBrowserCredentialClientId;
307312
dacClone.WorkloadIdentityClientId = WorkloadIdentityClientId;
308313
dacClone.ManagedIdentityClientId = ManagedIdentityClientId;

0 commit comments

Comments
 (0)