Skip to content

Commit 65b2004

Browse files
committed
Bug fixes for development time credentials
1 parent 01a82ba commit 65b2004

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

sdk/identity/Azure.Identity/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 1.10.2 (2023-10-10)
4+
5+
### Bugs Fixed
6+
7+
- Bug fixes for development time credentials.
8+
39
## 1.10.1 (2023-09-12)
410

511
### Bugs Fixed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ internal AzureCliCredential(CredentialPipeline pipeline, IProcessService process
7373
_pipeline = pipeline;
7474
_path = !string.IsNullOrEmpty(EnvironmentVariables.Path) ? EnvironmentVariables.Path : DefaultPath;
7575
_processService = processService ?? ProcessService.Default;
76-
TenantId = options?.TenantId;
76+
TenantId = Validations.ValidateTenantId(options?.TenantId, $"{nameof(options)}.{nameof(options.TenantId)}", true);
7777
AdditionallyAllowedTenantIds = TenantIdResolver.ResolveAddionallyAllowedTenantIds((options as ISupportsAdditionallyAllowedTenants)?.AdditionallyAllowedTenants);
7878
ProcessTimeout = options?.ProcessTimeout ?? TimeSpan.FromSeconds(13);
7979
_isChainedCredential = options?.IsChainedCredential ?? false;
@@ -121,6 +121,7 @@ private async ValueTask<AccessToken> RequestCliAccessTokenAsync(bool async, Toke
121121
string resource = ScopeUtilities.ScopesToResource(context.Scopes);
122122
string tenantId = TenantIdResolver.Resolve(TenantId, context, AdditionallyAllowedTenantIds);
123123

124+
Validations.ValidateTenantId(tenantId, nameof(context.TenantId), true);
124125
ScopeUtilities.ValidateScope(resource);
125126

126127
GetFileNameAndArguments(resource, tenantId, out string fileName, out string argument);

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ internal AzureDeveloperCliCredential(CredentialPipeline pipeline, IProcessServic
6565
_logAccountDetails = options?.Diagnostics?.IsAccountIdentifierLoggingEnabled ?? false;
6666
_pipeline = pipeline;
6767
_processService = processService ?? ProcessService.Default;
68-
TenantId = options?.TenantId;
68+
TenantId = Validations.ValidateTenantId(options?.TenantId, $"{nameof(options)}.{nameof(options.TenantId)}", true);
6969
AdditionallyAllowedTenantIds = TenantIdResolver.ResolveAddionallyAllowedTenantIds((options as ISupportsAdditionallyAllowedTenants)?.AdditionallyAllowedTenants);
7070
ProcessTimeout = options?.ProcessTimeout ?? TimeSpan.FromSeconds(13);
7171
_isChainedCredential = options?.IsChainedCredential ?? false;
@@ -112,6 +112,13 @@ private async ValueTask<AccessToken> RequestCliAccessTokenAsync(bool async, Toke
112112
{
113113
string tenantId = TenantIdResolver.Resolve(TenantId, context, AdditionallyAllowedTenantIds);
114114

115+
Validations.ValidateTenantId(tenantId, nameof(context.TenantId), true);
116+
117+
foreach (var scope in context.Scopes)
118+
{
119+
ScopeUtilities.ValidateScope(scope);
120+
}
121+
115122
GetFileNameAndArguments(context.Scopes, tenantId, out string fileName, out string argument);
116123
ProcessStartInfo processStartInfo = GetAzureDeveloperCliProcessStartInfo(fileName, argument);
117124
using var processRunner = new ProcessRunner(_processService.Create(processStartInfo), ProcessTimeout, _logPII, cancellationToken);

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ internal AzurePowerShellCredential(AzurePowerShellCredentialOptions options, Cre
6363
UseLegacyPowerShell = false;
6464
_logPII = options?.IsUnsafeSupportLoggingEnabled ?? false;
6565
_logAccountDetails = options?.Diagnostics?.IsAccountIdentifierLoggingEnabled ?? false;
66-
TenantId = options?.TenantId;
66+
TenantId = Validations.ValidateTenantId(options?.TenantId, $"{nameof(options)}.{nameof(options.TenantId)}", true);
6767
_pipeline = pipeline ?? CredentialPipeline.GetInstance(options);
6868
_processService = processService ?? ProcessService.Default;
6969
AdditionallyAllowedTenantIds = TenantIdResolver.ResolveAddionallyAllowedTenantIds((options as ISupportsAdditionallyAllowedTenants)?.AdditionallyAllowedTenants);
@@ -139,9 +139,12 @@ private async ValueTask<AccessToken> RequestAzurePowerShellAccessTokenAsync(bool
139139
{
140140
string resource = ScopeUtilities.ScopesToResource(context.Scopes);
141141

142-
ScopeUtilities.ValidateScope(resource);
143142
var tenantId = TenantIdResolver.Resolve(TenantId, context, AdditionallyAllowedTenantIds);
144143

144+
Validations.ValidateTenantId(tenantId, nameof(context.TenantId), true);
145+
146+
ScopeUtilities.ValidateScope(resource);
147+
145148
GetFileNameAndArguments(resource, tenantId, out string fileName, out string argument);
146149
ProcessStartInfo processStartInfo = GetAzurePowerShellProcessStartInfo(fileName, argument);
147150
using var processRunner = new ProcessRunner(

0 commit comments

Comments
 (0)