Skip to content

Commit b2caaff

Browse files
authored
Merge pull request Azure#6244 from markcowl/oauth-preview
Remove need for profile changes in storage OAuth support
2 parents 3ed8855 + 9708615 commit b2caaff

File tree

7 files changed

+36
-22
lines changed

7 files changed

+36
-22
lines changed

src/ResourceManager/Storage/AzureRM.Storage.psd1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '5.0.2'
15+
ModuleVersion = '5.0.1'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -130,10 +130,8 @@ PrivateData = @{
130130
# IconUri = ''
131131

132132
# ReleaseNotes of this module
133-
ReleaseNotes = '* Support create Storage Context with OAuth.
134-
- The PR pending change:
135-
- Change to signed package
136-
- Use AuthenticationFactory in Powershell to replace ADAL reference.'
133+
ReleaseNotes = '* Query Storage Usage By Location
134+
- Get-AzureRmStorageUsage'
137135

138136
# Prerelease string of this module
139137
Prerelease = 'preview'

src/ResourceManager/Storage/Commands.Management.Storage/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
// You can specify all the values or you can default the Build and Revision Numbers
4747
// by using the '*' as shown below:
4848

49-
[assembly: AssemblyVersion("5.0.2")]
50-
[assembly: AssemblyFileVersion("5.0.2")]
49+
[assembly: AssemblyVersion("5.0.1")]
50+
[assembly: AssemblyFileVersion("5.0.1")]

src/ServiceManagement/Azure.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CLRVersion = '4.0'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'Azure.Storage'; ModuleVersion = '4.3.0'; })
54+
#RequiredModules = ''
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
# RequiredAssemblies = @()

src/Storage/Azure.Storage.psd1

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '4.3.0'
15+
ModuleVersion = '4.4.0'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -158,16 +158,10 @@ PrivateData = @{
158158
# IconUri = ''
159159

160160
# ReleaseNotes of this module
161-
ReleaseNotes = '* Set minimum dependency of module to PowerShell 5.0
162-
* Support as Storage blob container name
163-
- New-AzureStorageBlobContainer
164-
- Remove-AzureStorageBlobContainer
165-
- Set-AzureStorageBlobContent
166-
- Get-AzureStorageBlobContent
167-
* Fix the issue that some Storage cmdlets failure output not contain detail failure information'
161+
ReleaseNotes = '* Support creating Storage Context with OAuth credentials.'
168162

169163
# Prerelease string of this module
170-
# Prerelease = ''
164+
Prerelease = 'preview'
171165

172166
# Flag to indicate whether the module requires explicit user acceptance for install/update
173167
# RequireLicenseAcceptance = $false

src/Storage/Commands.Storage/Common/Cmdlet/NewAzureStorageContext.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ namespace Microsoft.WindowsAzure.Commands.Storage.Common.Cmdlet
3737
OutputType(typeof(AzureStorageContext))]
3838
public class NewAzureStorageContext : AzureDataCmdlet
3939
{
40+
/// <summary>
41+
/// Default resourceId for storage OAuth tokens
42+
/// </summary>
43+
public const string StorageOAuthEndpointResourceValue = "https://storage.azure.com";
44+
45+
/// <summary>
46+
/// The extension key to use for the storage token audience value
47+
/// </summary>
48+
public const string StorageOAuthEndpointResourceKey = "StorageOAuthEndpointResourceId";
49+
4050
/// <summary>
4151
/// Account name and key parameter set name
4252
/// </summary>
@@ -356,6 +366,19 @@ private RenewTokenFuncAsync GetTokenRenewer(IAccessToken accessToken)
356366
return renewer;
357367
}
358368

369+
private IAzureEnvironment EnsureStorageOAuthAudienceSet(IAzureEnvironment environment)
370+
{
371+
if (environment != null)
372+
{
373+
if (!environment.IsPropertySet(StorageOAuthEndpointResourceKey))
374+
{
375+
environment.SetProperty(StorageOAuthEndpointResourceKey, StorageOAuthEndpointResourceValue);
376+
}
377+
}
378+
379+
return environment;
380+
}
381+
359382
/// <summary>
360383
/// Create a OAuth Token
361384
/// </summary>
@@ -364,12 +387,12 @@ private IAccessToken CreateOAuthToken()
364387
{
365388
IAccessToken accessToken = AzureSession.Instance.AuthenticationFactory.Authenticate(
366389
DefaultContext.Account,
367-
DefaultContext.Environment,
390+
EnsureStorageOAuthAudienceSet(DefaultContext.Environment),
368391
DefaultContext.Tenant.Id,
369392
null,
370393
ShowDialog.Never,
371394
null,
372-
AzureEnvironment.ExtendedEndpoint.StorageOAuthEndpointResourceId);
395+
StorageOAuthEndpointResourceKey);
373396
return accessToken;
374397
}
375398

src/Storage/Commands.Storage/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
// You can specify all the values or you can default the Build and Revision Numbers
4545
// by using the '*' as shown below:
4646
// [assembly: AssemblyVersion("1.0.*")]
47-
[assembly: AssemblyVersion("4.3.0")]
48-
[assembly: AssemblyFileVersion("4.3.0")]
47+
[assembly: AssemblyVersion("4.4.0")]
48+
[assembly: AssemblyFileVersion("4.4.0")]
4949

5050
#if SIGN
5151
[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.Commands.Storage.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]

tools/AzureRM/AzureRM.psd1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ CLRVersion = '4.0'
5252

5353
# Modules that must be imported into the global environment prior to importing this module
5454
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; RequiredVersion = '5.0.0'; },
55-
@{ModuleName = 'Azure.Storage'; RequiredVersion = '4.3.0'; },
5655
@{ModuleName = 'AzureRM.AnalysisServices'; RequiredVersion = '0.6.7'; },
5756
@{ModuleName = 'Azure.AnalysisServices'; RequiredVersion = '0.5.1'; },
5857
@{ModuleName = 'AzureRM.ApiManagement'; RequiredVersion = '6.0.0'; },

0 commit comments

Comments
 (0)