Skip to content

Commit c98e0b2

Browse files
authored
Merge pull request #11223 from wastoresh/mergestorage
[Storage] merge the lastest change on master to storage branch
2 parents f82a8ed + 2098d23 commit c98e0b2

File tree

195 files changed

+56911
-19015
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+56911
-19015
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
* Az.IotHub added cmdlets to support to manage devices.
55
* Az.SqlVirtualMachine added cmdlets for Availability Group Listener.
66

7+
#### Az.Resource
8+
* Fixed bug preventing correct tenant-level resource id generation.
9+
* Fixed typo.
10+
711
#### Az.Accounts
812
* Added SubscriptionId, TenantId, and execution time into data of client side telemetry
913

VirtualMachineCustomScriptExtensionManagedDisk.json

Lines changed: 0 additions & 3814 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
using Xunit.Abstractions;
18+
19+
namespace Microsoft.Azure.Commands.Profile.Test
20+
{
21+
public class ErrorResolutionScenarioTests : AccountsTestRunner
22+
{
23+
public ErrorResolutionScenarioTests(ITestOutputHelper output)
24+
: base(output)
25+
{
26+
}
27+
28+
[Fact]
29+
[Trait(Category.AcceptanceType, Category.CheckIn)]
30+
public void WriteInformationInResolveError()
31+
{
32+
TestRunner.RunTestScript("Test-WriteInformationInResolveError");
33+
}
34+
}
35+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
<#
16+
.SYNOPSIS
17+
Tests cmdlets surrounding default resource group
18+
#>
19+
20+
function Test-WriteInformationInResolveError
21+
{
22+
Assert-Throws { Connect-AzAccount -Wrong }
23+
$err = Resolve-AzError -Last
24+
Assert-AreEqual 1 $err.length
25+
Assert-AreEqual "Microsoft.Azure.Commands.Profile.Errors.AzureExceptionRecord" $err[0].GetType().FullName
26+
}

src/Accounts/Accounts.Test/ErrorResolutionTests.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void HandlesExceptionError()
6666
var response = new HttpResponseMessage(HttpStatusCode.BadRequest);
6767
var hyakException = new TestHyakException("exception message", CloudHttpRequestErrorInfo.Create(request), CloudHttpResponseErrorInfo.Create(response))
6868
{
69-
Error = new Hyak.Common.CloudError { Code="HyakCode", Message="HyakError"}
69+
Error = new Hyak.Common.CloudError { Code = "HyakCode", Message = "HyakError" }
7070
};
7171

7272
var autorestException = new Microsoft.Rest.Azure.CloudException("exception message")
@@ -79,16 +79,15 @@ public void HandlesExceptionError()
7979

8080
var cmdlet = new ResolveError
8181
{
82-
Error = new []
82+
Error = new[]
8383
{
8484
new ErrorRecord(new Exception("exception message"), "errorCode", ErrorCategory.AuthenticationError, this),
8585
new ErrorRecord(hyakException, "errorCode", ErrorCategory.ConnectionError, this),
8686
new ErrorRecord(autorestException , "errorCode", ErrorCategory.InvalidOperation, this),
8787
},
8888
CommandRuntime = runtime
8989
};
90-
91-
cmdlet.ExecuteCmdlet();
90+
Assert.Throws<NotImplementedException>(() => cmdlet.ExecuteCmdlet());
9291
Assert.NotNull(runtime.OutputPipeline);
9392
Assert.Equal(3, runtime.OutputPipeline.Count);
9493
var errorResult = runtime.OutputPipeline[0] as AzureExceptionRecord;
@@ -130,9 +129,9 @@ public void HandlesNullValuesInArmExceptions()
130129
{
131130
var runtime = new MockCommandRuntime();
132131
var hyakException = new TestHyakException(null, null, null);
133-
132+
134133
var autorestException = new Microsoft.Rest.Azure.CloudException();
135-
134+
136135
var cmdlet = new ResolveError
137136
{
138137
Error = new[]
@@ -143,8 +142,8 @@ public void HandlesNullValuesInArmExceptions()
143142
},
144143
CommandRuntime = runtime
145144
};
146-
147-
cmdlet.ExecuteCmdlet();
145+
146+
Assert.Throws<NotImplementedException>(() => cmdlet.ExecuteCmdlet());
148147
Assert.NotNull(runtime.OutputPipeline);
149148
Assert.Equal(3, runtime.OutputPipeline.Count);
150149
var errorResult = runtime.OutputPipeline[0] as AzureExceptionRecord;
@@ -173,7 +172,7 @@ public void LastParameterFindsLastError()
173172
var cmdlet = new ResolveError { CommandRuntime = mock };
174173
var message = "RuntimeErrorMessage";
175174
var exception = new Exception(message);
176-
cmdlet.ExecuteCmdletWithExceptionInPipeline<AzureErrorRecord>("Resolve-AzureRmError", exception, new KeyValuePair<string, object>("Last", null ) );
175+
cmdlet.ExecuteCmdletWithExceptionInPipeline<AzureErrorRecord>("Resolve-AzureRmError", exception, new KeyValuePair<string, object>("Last", null));
177176
Assert.NotNull(mock.ErrorStream);
178177
Assert.Single(mock.ErrorStream);
179178
Assert.NotNull(mock.OutputPipeline);
@@ -183,8 +182,6 @@ public void LastParameterFindsLastError()
183182
Assert.NotNull(record.Exception);
184183
Assert.Equal(typeof(Exception), record.Exception.GetType());
185184
Assert.Equal(message, record.Message);
186-
187-
188185
}
189186
}
190187
}

src/Accounts/Accounts.Test/SendFeedbackTests.cs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -58,35 +58,5 @@ public void SendFeedbackFailsInNonInteractive()
5858
cmdlet.InvokeBeginProcessing();
5959
});
6060
}
61-
62-
[Fact]
63-
[Trait(Category.AcceptanceType, Category.CheckIn)]
64-
public void CanSerializeSimpleFeedbackPayloadIntoProperForm()
65-
{
66-
var payload = new PSAzureFeedback
67-
{
68-
ModuleName = "Module",
69-
ModuleVersion = "1.0.0",
70-
SubscriptionId = Guid.NewGuid().ToString(),
71-
TenantId = Guid.NewGuid().ToString(),
72-
Environment = "AzureCloud",
73-
Recommendation = 10,
74-
PositiveComments = "Positive",
75-
NegativeComments = "Negative",
76-
77-
};
78-
79-
var serializedPayload = MetricHelper.SerializeCustomEventPayload(payload);
80-
81-
Assert.Equal(payload.ModuleName, serializedPayload["moduleName"]);
82-
Assert.Equal(payload.ModuleVersion, serializedPayload["moduleVersion"]);
83-
Assert.Equal(payload.SubscriptionId.ToString(), serializedPayload["subscriptionId"]);
84-
Assert.Equal(payload.TenantId.ToString(), serializedPayload["tenantId"]);
85-
Assert.Equal(payload.Environment, serializedPayload["environment"]);
86-
Assert.Equal(payload.Recommendation.ToString(), serializedPayload["recommendation"]);
87-
Assert.Equal(payload.PositiveComments, serializedPayload["positiveComments"]);
88-
Assert.Equal(payload.NegativeComments, serializedPayload["negativeComments"]);
89-
Assert.Equal(payload.Email, serializedPayload["email"]);
90-
}
9161
}
9262
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "/tenants?api-version=2016-06-01",
5+
"EncodedRequestUri": "L3RlbmFudHM/YXBpLXZlcnNpb249MjAxNi0wNi0wMQ==",
6+
"RequestMethod": "GET",
7+
"RequestBody": "",
8+
"RequestHeaders": {
9+
"x-ms-client-request-id": [
10+
"5b28f448-239c-4ac6-ab5c-d706ee4ec51e"
11+
],
12+
"Accept-Language": [
13+
"en-US"
14+
],
15+
"User-Agent": [
16+
"FxVersion/4.6.28207.03",
17+
"OSName/Windows",
18+
"OSVersion/Microsoft.Windows.10.0.18363.",
19+
"Microsoft.Azure.Internal.Subscriptions.SubscriptionClient/1.3.7"
20+
]
21+
},
22+
"ResponseHeaders": {
23+
"Cache-Control": [
24+
"no-cache"
25+
],
26+
"Pragma": [
27+
"no-cache"
28+
],
29+
"x-ms-ratelimit-remaining-tenant-reads": [
30+
"11998"
31+
],
32+
"x-ms-request-id": [
33+
"7762c02a-4ba5-43be-a37c-a6c802f5585f"
34+
],
35+
"x-ms-correlation-request-id": [
36+
"7762c02a-4ba5-43be-a37c-a6c802f5585f"
37+
],
38+
"x-ms-routing-request-id": [
39+
"EASTASIA:20200213T030718Z:7762c02a-4ba5-43be-a37c-a6c802f5585f"
40+
],
41+
"Strict-Transport-Security": [
42+
"max-age=31536000; includeSubDomains"
43+
],
44+
"X-Content-Type-Options": [
45+
"nosniff"
46+
],
47+
"Date": [
48+
"Thu, 13 Feb 2020 03:07:18 GMT"
49+
],
50+
"Content-Type": [
51+
"application/json; charset=utf-8"
52+
],
53+
"Expires": [
54+
"-1"
55+
],
56+
"Content-Length": [
57+
"116"
58+
]
59+
},
60+
"ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/tenants/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a\",\r\n \"tenantId\": \"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a\"\r\n }\r\n ]\r\n}",
61+
"StatusCode": 200
62+
},
63+
{
64+
"RequestUri": "/subscriptions?api-version=2016-06-01",
65+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNi0wNi0wMQ==",
66+
"RequestMethod": "GET",
67+
"RequestBody": "",
68+
"RequestHeaders": {
69+
"x-ms-client-request-id": [
70+
"b5c0f48f-43ab-4f48-a1e6-84b4a1892524"
71+
],
72+
"Accept-Language": [
73+
"en-US"
74+
],
75+
"User-Agent": [
76+
"FxVersion/4.6.28207.03",
77+
"OSName/Windows",
78+
"OSVersion/Microsoft.Windows.10.0.18363.",
79+
"Microsoft.Azure.Internal.Subscriptions.SubscriptionClient/1.3.7"
80+
]
81+
},
82+
"ResponseHeaders": {
83+
"Cache-Control": [
84+
"no-cache"
85+
],
86+
"Pragma": [
87+
"no-cache"
88+
],
89+
"x-ms-ratelimit-remaining-tenant-reads": [
90+
"11999"
91+
],
92+
"x-ms-request-id": [
93+
"fe449bd7-d1f4-452d-9a58-84fee8efa1b7"
94+
],
95+
"x-ms-correlation-request-id": [
96+
"fe449bd7-d1f4-452d-9a58-84fee8efa1b7"
97+
],
98+
"x-ms-routing-request-id": [
99+
"EASTASIA:20200213T030719Z:fe449bd7-d1f4-452d-9a58-84fee8efa1b7"
100+
],
101+
"Strict-Transport-Security": [
102+
"max-age=31536000; includeSubDomains"
103+
],
104+
"X-Content-Type-Options": [
105+
"nosniff"
106+
],
107+
"Date": [
108+
"Thu, 13 Feb 2020 03:07:18 GMT"
109+
],
110+
"Content-Type": [
111+
"application/json; charset=utf-8"
112+
],
113+
"Expires": [
114+
"-1"
115+
],
116+
"Content-Length": [
117+
"332"
118+
]
119+
},
120+
"ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590\",\r\n \"authorizationSource\": \"RoleBased\",\r\n \"subscriptionId\": \"0b1f6471-1bf0-4dda-aec3-cb9272f09590\",\r\n \"displayName\": \"AzureSDKTest\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\",\r\n \"spendingLimit\": \"Off\"\r\n }\r\n }\r\n ]\r\n}",
121+
"StatusCode": 200
122+
}
123+
],
124+
"Names": {},
125+
"Variables": {
126+
"SubscriptionId": "0b1f6471-1bf0-4dda-aec3-cb9272f09590"
127+
}
128+
}

src/Accounts/Accounts/AzureRmAlias/Mappings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,8 @@
20232023
"Set-AzADUser": "Set-AzureRmADUser",
20242024
"Remove-AzTag": "Remove-AzureRmTag",
20252025
"Get-AzTag": "Get-AzureRmTag",
2026-
"New-AzTag": "New-AzureRmTag"
2026+
"New-AzTag": "New-AzureRmTag",
2027+
"Update-AzTag": "Update-AzureRmTag"
20272028
},
20282029
"Az.Scheduler": {
20292030
"Disable-AzSchedulerJobCollection": "Disable-AzureRmSchedulerJobCollection",

src/Accounts/Accounts/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
## Version 1.7.2
2323
* Added SubscriptionId, TenantId, and execution time into data of client side telemetry
24+
* Display Azure Powershell survey url to Resolve-Error [#11020](https://github.com/Azure/azure-powershell/issues/11020).
25+
* Open AzurePowershell survey page in Send-Feedback [#11021](https://github.com/Azure/azure-powershell/issues/11021).
2426

2527
## Version 1.7.1
2628
* Disable context auto saving when AzureRmContext.json not available

src/Accounts/Accounts/Common/AzureProfileConstants.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,22 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System;
16-
using System.Collections.Generic;
17-
using System.Linq;
18-
using System.Text;
19-
using System.Threading.Tasks;
15+
using Microsoft.Azure.Commands.Profile.Properties;
2016

2117
namespace Microsoft.Azure.Commands.Profile.Common
2218
{
2319
public static class AzureProfileConstants
2420
{
2521
public const string AzureAutosaveVariable = "Azure_Profile_Autosave";
22+
23+
public const string AzureSurveyUrl = "https://aka.ms/azpssurvey?Q_CHL=FEEDBACK";
24+
25+
public static readonly string AzurePowerShellFeedbackMessage = string.Format(Resources.AzurePowerShellFeedback, AzureProfileConstants.AzureSurveyUrl);
26+
27+
public static readonly string AzurePowerShellFeedbackQuestion = string.Format(Resources.SendFeedbackOpenLinkAutomatically, AzureProfileConstants.AzureSurveyUrl);
28+
29+
public static readonly string AzurePowerShellFeedbackManually = string.Format(Resources.SendFeedbackOpenLinkManually, AzureProfileConstants.AzureSurveyUrl);
30+
31+
public static readonly string AzurePowerShellFeedbackWarning = string.Format(Resources.DefaultBrowserOpenFailure, AzureProfileConstants.AzureSurveyUrl);
2632
}
2733
}

src/Accounts/Accounts/Errors/ResolveError.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
using System.Linq;
1818
using System.Management.Automation;
1919
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
20+
using Microsoft.Azure.Commands.Profile.Common;
21+
using Microsoft.Azure.Commands.Profile.Properties;
2022
using System.Collections;
2123
using Microsoft.Azure.Commands.ResourceManager.Common;
2224
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
@@ -79,6 +81,10 @@ public override void ExecuteCmdlet()
7981
HandleError(record);
8082
}
8183
}
84+
var informationMessage = new HostInformationMessage();
85+
informationMessage.Message = $"{Environment.NewLine}{AzureProfileConstants.AzurePowerShellFeedbackMessage}{Environment.NewLine}";
86+
informationMessage.NoNewLine = false;
87+
WriteInformation(informationMessage, new string[] { "PSHOST" });
8288
}
8389

8490
private IEnumerable<ErrorRecord> GetErrorVariable()

0 commit comments

Comments
 (0)