Skip to content

Commit 387ccca

Browse files
2 parents 419bcf0 + 526a74b commit 387ccca

File tree

25 files changed

+1466
-276
lines changed

25 files changed

+1466
-276
lines changed

src/Accounts/Accounts.Test/SessionRecords/Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests/AllParameterSetsSucceed.json

Lines changed: 129 additions & 249 deletions
Large diffs are not rendered by default.

src/Accounts/Accounts.Test/SubscriptionCmdletTests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function Test-GetSubscriptionsEndToEnd
4545
Assert-True {$mostSubscriptions.Count -gt 0}
4646
$tenantSubscriptions = Get-AzSubscription -Tenant $tenant
4747
Assert-True {$tenantSubscriptions.Count -gt 0}
48+
Assert-NotNull $subscription.SubscriptionPolicies
4849
}
4950

5051
<#
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
2+
using Microsoft.Azure.Commands.Profile.Models;
3+
using Microsoft.Azure.Internal.Subscriptions.Models;
4+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
5+
using Newtonsoft.Json;
6+
using System;
7+
using Xunit;
8+
9+
namespace Microsoft.Azure.Commands.Profile.Test.UnitTest
10+
{
11+
public class PSAzureSubscriptionTest
12+
{
13+
14+
[Fact]
15+
[Trait(Category.AcceptanceType, Category.CheckIn)]
16+
public void NewPSAzureSubscription()
17+
{
18+
string locationPlacementId = "Internal_2014-09-01";
19+
string quotaId= "Internal_2014-09-01";
20+
SpendingLimit spendingLimit = SpendingLimit.Off;
21+
var subscriptionPolicies = new SubscriptionPolicies(locationPlacementId, quotaId, spendingLimit);
22+
23+
// test PSAzureSubscriptionPolicies' constructors
24+
var psAzureSubscriptionPolicies = new PSAzureSubscriptionPolicy(subscriptionPolicies);
25+
Assert.Equal(psAzureSubscriptionPolicies.LocationPlacementId, locationPlacementId);
26+
Assert.Equal(psAzureSubscriptionPolicies.QuotaId, quotaId);
27+
Assert.Equal(psAzureSubscriptionPolicies.SpendingLimit, spendingLimit.ToString());
28+
29+
var psAzureSubscriptionPolicies2 = new PSAzureSubscriptionPolicy(JsonConvert.SerializeObject(subscriptionPolicies));
30+
Assert.Equal(psAzureSubscriptionPolicies2.LocationPlacementId, locationPlacementId);
31+
Assert.Equal(psAzureSubscriptionPolicies2.QuotaId, quotaId);
32+
Assert.Equal(psAzureSubscriptionPolicies2.SpendingLimit, spendingLimit.ToString());
33+
34+
var sub = new AzureSubscription
35+
{
36+
Id = new Guid().ToString(),
37+
Name = "Contoso Test Subscription",
38+
State = "Enabled",
39+
};
40+
sub.SetAccount("[email protected]");
41+
sub.SetEnvironment("testCloud");
42+
sub.SetTenant(new Guid("3c0ff8a7-e8bb-40e8-ae66-271343379af6").ToString());
43+
sub.SetSubscriptionPolicies(JsonConvert.SerializeObject(subscriptionPolicies));
44+
45+
// test PSAzureSubscription's constructor
46+
var psAzureSubscription = new PSAzureSubscription(sub);
47+
Assert.NotNull(psAzureSubscription.SubscriptionPolicies);
48+
Assert.Equal(psAzureSubscription.SubscriptionPolicies.LocationPlacementId, locationPlacementId);
49+
Assert.Equal(psAzureSubscription.SubscriptionPolicies.QuotaId, quotaId);
50+
Assert.Equal(psAzureSubscription.SubscriptionPolicies.SpendingLimit, spendingLimit.ToString());
51+
}
52+
}
53+
}

src/Accounts/Accounts/Accounts.format.ps1xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,45 @@
171171
</TableRowEntries>
172172
</TableControl>
173173
</View>
174+
<View>
175+
<Name>Microsoft.Azure.Commands.Profile.Models.PSAzureSubscriptionPolicy</Name>
176+
<ViewSelectedBy>
177+
<TypeName>Microsoft.Azure.Commands.Profile.Models.PSAzureSubscriptionPolicy</TypeName>
178+
</ViewSelectedBy>
179+
<TableControl>
180+
<TableHeaders>
181+
<TableColumnHeader>
182+
<Alignment>Left</Alignment>
183+
<Label>locationPlacementId</Label>
184+
</TableColumnHeader>
185+
<TableColumnHeader>
186+
<Alignment>Left</Alignment>
187+
<Label>QuotaId</Label>
188+
</TableColumnHeader>
189+
<TableColumnHeader>
190+
<Alignment>Left</Alignment>
191+
<Label>SpendingLimit</Label>
192+
</TableColumnHeader>
193+
</TableHeaders>
194+
<TableRowEntries>
195+
<TableRowEntry>
196+
<TableColumnItems>
197+
<TableColumnItem>
198+
<Alignment>Left</Alignment>
199+
<PropertyName>locationPlacementId</PropertyName>
200+
</TableColumnItem>
201+
<TableColumnItem>
202+
<Alignment>Left</Alignment>
203+
<PropertyName>QuotaId</PropertyName>
204+
</TableColumnItem>
205+
<TableColumnItem>
206+
<Alignment>Left</Alignment>
207+
<PropertyName>SpendingLimit</PropertyName>
208+
</TableColumnItem>
209+
</TableColumnItems>
210+
</TableRowEntry>
211+
</TableRowEntries>
212+
</TableControl>
213+
</View>
174214
</ViewDefinitions>
175215
</Configuration>

src/Accounts/Accounts/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Exposed SubscriptionPolicies in `Get-AzSubscription` [#12551]
2122

2223
## Version 1.9.2
2324
* Updated `Connect-AzAccount` to accept parameter `MaxContextPopulation` [#9865]

src/Accounts/Authentication.ResourceManager/Models/PSAzureSubscription.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,19 @@ public string CurrentStorageAccountName
152152
}
153153
}
154154

155+
private PSAzureSubscriptionPolicy _subscriptionPolicies;
156+
157+
public PSAzureSubscriptionPolicy SubscriptionPolicies {
158+
get
159+
{
160+
if (this._subscriptionPolicies == null)
161+
{
162+
this._subscriptionPolicies= new PSAzureSubscriptionPolicy(this.GetSubscriptionPolicies());
163+
}
164+
return this._subscriptionPolicies;
165+
}
166+
}
167+
155168
public IDictionary<string, string> ExtendedProperties { get; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
156169

157170
public string CurrentStorageAccount
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using Newtonsoft.Json;
2+
using Microsoft.Azure.Internal.Subscriptions.Models;
3+
4+
namespace Microsoft.Azure.Commands.Profile.Models
5+
{
6+
public class PSAzureSubscriptionPolicy
7+
{
8+
/// <summary>
9+
/// Default constructor
10+
/// </summary>
11+
public PSAzureSubscriptionPolicy()
12+
{
13+
14+
}
15+
16+
/// <summary>
17+
/// object constructor
18+
/// </summary>
19+
/// <param name="azureSubscriptionPolicies">Json string to convert</param>
20+
public PSAzureSubscriptionPolicy(SubscriptionPolicies subscriptionPolicies)
21+
{
22+
if (subscriptionPolicies != null)
23+
{
24+
this.LocationPlacementId = subscriptionPolicies.LocationPlacementId;
25+
this.QuotaId = subscriptionPolicies.QuotaId;
26+
this.SpendingLimit = subscriptionPolicies.SpendingLimit.ToString();
27+
}
28+
}
29+
30+
/// <summary>
31+
/// string constructor
32+
/// </summary>
33+
/// <param name="azureSubscriptionPolicies">Json string to convert</param>
34+
public PSAzureSubscriptionPolicy(string azureSubscriptionPolicies) : this(string.IsNullOrEmpty(azureSubscriptionPolicies)?null:JsonConvert.DeserializeObject<SubscriptionPolicies>(azureSubscriptionPolicies)) { }
35+
36+
public string LocationPlacementId { get; private set; }
37+
38+
public string QuotaId { get; private set; }
39+
40+
public string SpendingLimit { get; private set; }
41+
42+
public override string ToString()
43+
{
44+
return JsonConvert.SerializeObject(this, Formatting.Indented,
45+
new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });
46+
}
47+
48+
}
49+
}

src/Accounts/Authentication/Utilities/CustomAssemblyResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static class CustomAssemblyResolver
1010
private static IDictionary<string, Version> NetFxPreloadAssemblies =
1111
new Dictionary<string, Version>(StringComparer.InvariantCultureIgnoreCase)
1212
{
13-
{"Azure.Core", new Version("1.2.2.0")},
13+
{"Azure.Core", new Version("1.3.0.0")},
1414
{"Microsoft.Bcl.AsyncInterfaces", new Version("1.0.0.0")},
1515
{"Microsoft.IdentityModel.Clients.ActiveDirectory", new Version("3.19.2.6005")},
1616
{"Microsoft.IdentityModel.Clients.ActiveDirectory.Platform", new Version("3.19.2.6005")},

src/Storage/Storage.Management.Test/Storage.Management.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Azure.Storage.Blobs" Version="12.5.0-preview.5" />
15-
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.3.0-preview.1" />
16-
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.3.0-preview.1" />
17-
<PackageReference Include="Azure.Storage.Queues" Version="12.4.0-preview.5" />
14+
<PackageReference Include="Azure.Storage.Blobs" Version="12.5.0-preview.6" />
15+
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.3.0-preview.2" />
16+
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.3.0-preview.2" />
17+
<PackageReference Include="Azure.Storage.Queues" Version="12.4.0-preview.6" />
1818
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="17.1.0" />
1919
</ItemGroup>
2020

src/Storage/Storage.Management/Az.Storage.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ CmdletsToExport = 'Get-AzStorageAccount', 'Get-AzStorageAccountKey',
165165
'New-AzDataLakeGen2Item', 'Move-AzDataLakeGen2Item',
166166
'Remove-AzDataLakeGen2Item', 'Update-AzDataLakeGen2Item',
167167
'Set-AzDataLakeGen2ItemAclObject', 'Get-AzDataLakeGen2ItemContent',
168-
'Invoke-AzStorageAccountFailover'
168+
'Invoke-AzStorageAccountFailover',
169+
'Get-AzStorageBlobQueryResult', 'New-AzStorageBlobQueryConfig'
169170

170171
# Variables to export from this module
171172
# VariablesToExport = @()

src/Storage/Storage.Management/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Supported blob query acceleration
22+
- `Get-AzStorageBlobQueryResult`
23+
- `New-AzStorageBlobQueryConfig`
2124

2225
## Version 2.4.0
2326
* Supported create container/blob Sas token with new permission x,t

src/Storage/Storage.Management/help/Az.Storage.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ Downloads a storage blob.
8383
### [Get-AzStorageBlobCopyState](Get-AzStorageBlobCopyState.md)
8484
Gets the copy status of an Azure Storage blob.
8585

86+
### [Get-AzStorageBlobQueryResult](Get-AzStorageBlobQueryResult.md)
87+
Applies a simple Structured Query Language (SQL) statement on a blob's contents and save only the queried subset of the data to a local file.
88+
8689
### [Get-AzStorageBlobServiceProperty](Get-AzStorageBlobServiceProperty.md)
8790
Gets service properties for Azure Storage Blob services.
8891

@@ -170,6 +173,9 @@ Creates a ManagementPolicy rule object, which can be used in Set-AzStorageAccoun
170173
### [New-AzStorageAccountSASToken](New-AzStorageAccountSASToken.md)
171174
Creates an account-level SAS token.
172175

176+
### [New-AzStorageBlobQueryConfig](New-AzStorageBlobQueryConfig.md)
177+
Creates a blob query configuration object, which can be used in Get-AzStorageBlobQueryResult.
178+
173179
### [New-AzStorageBlobSASToken](New-AzStorageBlobSASToken.md)
174180
Generates a SAS token for an Azure storage blob.
175181

0 commit comments

Comments
 (0)