Skip to content

Commit 90088ba

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into dev
2 parents 29d780a + c99c1eb commit 90088ba

File tree

62 files changed

+15329
-1950
lines changed

Some content is hidden

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

62 files changed

+15329
-1950
lines changed

src/ResourceManager/KeyVault/Commands.KeyVault.Test/Commands.KeyVault.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
6666
</Reference>
6767
<Reference Include="Microsoft.Azure.Graph.RBAC">
68-
<HintPath>..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.7.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll</HintPath>
68+
<HintPath>..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.8.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll</HintPath>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.KeyVault, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7171
<SpecificVersion>False</SpecificVersion>

src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
125125
</Reference>
126126
<Reference Include="Microsoft.Azure.Graph.RBAC">
127-
<HintPath>..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.7.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll</HintPath>
127+
<HintPath>..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.8.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll</HintPath>
128128
</Reference>
129129
<Reference Include="Microsoft.Azure.KeyVault, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
130130
<SpecificVersion>False</SpecificVersion>

src/ResourceManager/Profile/Commands.Profile/Properties/Resources.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@
166166
<value>To create an access token credential, you must provide an access token account.</value>
167167
</data>
168168
<data name="UnableToAqcuireToken" xml:space="preserve">
169-
<value>Unabe to acquire token for tenant '{0}'</value>
169+
<value>Unable to acquire token for tenant '{0}'</value>
170170
</data>
171171
<data name="UnknownEnvironment" xml:space="preserve">
172172
<value>Unable to find environment with name '{0}'</value>
173173
</data>
174-
</root>
174+
</root>

src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/Commands.RecoveryServices.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@
4848
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
4949
</Reference>
5050
<Reference Include="Microsoft.Azure.Management.RecoveryServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
51-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.1.0.1-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
51+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.1.0.2-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
5252
<Private>True</Private>
5353
</Reference>
5454
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5555
<SpecificVersion>False</SpecificVersion>
5656
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
5757
</Reference>
58-
<Reference Include="Microsoft.Azure.Test.Framework, Version=1.0.5774.40163, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
58+
<Reference Include="Microsoft.Azure.Test.Framework, Version=1.0.5799.28345, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5959
<SpecificVersion>False</SpecificVersion>
60-
<HintPath>..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5774.40163-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll</HintPath>
60+
<HintPath>..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5799.28345-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll</HintPath>
6161
<Private>True</Private>
6262
</Reference>
6363
<Reference Include="Microsoft.Azure.Test.HttpRecorder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6464
<SpecificVersion>False</SpecificVersion>
65-
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5774.40163-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
65+
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5799.28345-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
6666
<Private>True</Private>
6767
</Reference>
6868
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory">

src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.ps1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Recovery Services Vault CRUD Tests
2121
function Test-RecoveryServicesVaultCRUDTests
2222
{
2323
# Create vault
24-
$vaultCreationResponse = New-AzureRmRecoveryServicesVault -Name rsv1 -ResouceGroupName testsitegroup -Location westus
24+
$vaultCreationResponse = New-AzureRmRecoveryServicesVault -Name rsv1 -ResourceGroupName S91-1 -Location westus
2525
Assert-NotNull($vaultCreationResponse.Name)
2626
Assert-NotNull($vaultCreationResponse.ID)
2727
Assert-NotNull($vaultCreationResponse.Type)
@@ -38,16 +38,13 @@ function Test-RecoveryServicesVaultCRUDTests
3838
}
3939

4040
# Get the created vault
41-
$vaultToBeRemoved = Get-AzureRmRecoveryServicesVault -ResourceGroupName testsitegroup -Name rsv1
41+
$vaultToBeRemoved = Get-AzureRmRecoveryServicesVault -ResourceGroupName S91-1 -Name rsv1
4242
Assert-NotNull($vaultToBeRemoved.Name)
4343
Assert-NotNull($vaultToBeRemoved.ID)
4444
Assert-NotNull($vaultToBeRemoved.Type)
4545

46-
# Download Vault settings file
47-
Get-AzureRmRecoveryServicesVaultSettingsFile -Vault $vaultToBeRemoved
48-
4946
# Remove Vault
5047
Remove-AzureRmRecoveryServicesVault -Vault $vaultToBeRemoved
51-
$vaults = Get-AzureRmRecoveryServicesVault -ResourceGroupName testsitegroup -Name rsv1
48+
$vaults = Get-AzureRmRecoveryServicesVault -ResourceGroupName S91-1 -Name rsv1
5249
Assert-True { $vaults.Count -eq 0 }
5350
}

src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/ScenarioTests/RecoveryServicesTestsBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ public static T GetServiceClient<T>() where T : class
8484
if (testEnvironment.UsesCustomUri())
8585
{
8686
client = new RecoveryServicesManagementClient(
87-
"Microsoft.RecoveryServices",
87+
"Microsoft.RecoveryServicesBVTD2",
8888
testEnvironment.Credentials as SubscriptionCloudCredentials,
8989
testEnvironment.BaseUri);
9090
}
9191
else
9292
{
9393
client = new RecoveryServicesManagementClient(
94-
"Microsoft.RecoveryServices",
94+
"Microsoft.RecoveryServicesBVTD2",
9595
testEnvironment.Credentials as SubscriptionCloudCredentials);
9696
}
9797
return GetServiceClient<T>(factory, client);

src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/SessionRecords/Microsoft.Azure.Commands.RecoveryServices.Test.ScenarioTests.RecoveryServicesTests/VaultCRUDTests.json

Lines changed: 6254 additions & 164 deletions
Large diffs are not rendered by default.

src/ResourceManager/RecoveryServices/Commands.RecoveryServices.Test/packages.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Authentication" version="1.5.1-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
7-
<package id="Microsoft.Azure.Management.RecoveryServices" version="1.0.1-preview" targetFramework="net45" />
7+
<package id="Microsoft.Azure.Management.RecoveryServices" version="1.0.2-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Test.Framework" version="1.0.5774.40163-prerelease" targetFramework="net45" />
10-
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5774.40163-prerelease" targetFramework="net45" />
9+
<package id="Microsoft.Azure.Test.Framework" version="1.0.5799.28345-prerelease" targetFramework="net45" />
10+
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5799.28345-prerelease" targetFramework="net45" />
1111
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
1212
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
1313
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Commands.RecoveryServices.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
5353
</Reference>
5454
<Reference Include="Microsoft.Azure.Management.RecoveryServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
55-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.1.0.1-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
55+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.1.0.2-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
5656
<Private>True</Private>
5757
</Reference>
5858
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.18.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Common/PSRecoveryServicesVaultClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public partial class PSRecoveryServicesClient
2929
/// <returns>vault list response object.</returns>
3030
public VaultListResponse GetVaultsInResouceGroup(string resouceGroupName)
3131
{
32-
return this.GetRecoveryServicesClient.Vaults.Get(resouceGroupName, this.GetRequestHeaders());
32+
return this.GetRecoveryServicesClient.Vaults.List(resouceGroupName, this.GetRequestHeaders());
3333
}
3434

3535
/// <summary>

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Common/RecoveryServicesCmdletBase.cs

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
using Hyak.Common;
2020
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2121
using Microsoft.Azure.Commands.ResourceManager.Common;
22+
using Newtonsoft.Json;
23+
using System.Text;
2224

2325
namespace Microsoft.Azure.Commands.RecoveryServices
2426
{
@@ -68,36 +70,46 @@ public void HandleException(Exception ex)
6870
CloudException cloudException = ex as CloudException;
6971
if (cloudException != null)
7072
{
71-
Error error = null;
73+
ARMError error = null;
7274
try
7375
{
74-
using (Stream stream = new MemoryStream())
76+
if (cloudException.Message != null)
7577
{
76-
if (cloudException.Message != null)
77-
{
78-
byte[] data = System.Text.Encoding.UTF8.GetBytes(cloudException.Message);
79-
stream.Write(data, 0, data.Length);
80-
stream.Position = 0;
78+
string originalMessage = cloudException.Error.OriginalMessage;
79+
error = JsonConvert.DeserializeObject<ARMError>(originalMessage);
80+
81+
StringBuilder exceptionMessage = new StringBuilder();
82+
exceptionMessage.Append(Properties.Resources.CloudExceptionDetails);
8183

82-
var deserializer = new DataContractSerializer(typeof(ErrorInException));
83-
error = (Error)deserializer.ReadObject(stream);
84+
if (error.Error.Details != null)
85+
{
86+
foreach (ARMExceptionDetails detail in error.Error.Details)
87+
{
88+
if (!string.IsNullOrEmpty(detail.ErrorCode))
89+
exceptionMessage.AppendLine("ErrorCode: " + detail.ErrorCode);
90+
if (!string.IsNullOrEmpty(detail.Message))
91+
exceptionMessage.AppendLine("Message: " + detail.Message);
8492

85-
throw new InvalidOperationException(
86-
string.Format(
87-
Properties.Resources.CloudExceptionDetails,
88-
error.Message,
89-
error.PossibleCauses,
90-
error.RecommendedAction,
91-
error.ClientRequestId));
93+
exceptionMessage.AppendLine();
94+
}
9295
}
9396
else
9497
{
95-
throw new Exception(
96-
string.Format(
97-
Properties.Resources.InvalidCloudExceptionErrorMessage,
98-
clientRequestIdMsg + ex.Message),
99-
ex);
98+
if (!string.IsNullOrEmpty(error.Error.ErrorCode))
99+
exceptionMessage.AppendLine("ErrorCode: " + error.Error.ErrorCode);
100+
if (!string.IsNullOrEmpty(error.Error.Message))
101+
exceptionMessage.AppendLine("Message: " + error.Error.Message);
100102
}
103+
104+
throw new InvalidOperationException(exceptionMessage.ToString());
105+
}
106+
else
107+
{
108+
throw new Exception(
109+
string.Format(
110+
Properties.Resources.InvalidCloudExceptionErrorMessage,
111+
clientRequestIdMsg + ex.Message),
112+
ex);
101113
}
102114
}
103115
catch (XmlException)

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Models/PSContracts.cs

Lines changed: 98 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System.Text;
2020
using Microsoft.Azure.Commands.RecoveryServices;
2121
using Microsoft.Azure.Management.RecoveryServices.Models;
22+
using Newtonsoft.Json;
2223

2324
namespace Microsoft.Azure.Commands.RecoveryServices
2425
{
@@ -86,15 +87,107 @@ public enum RpErrorCode
8687
}
8788

8889
/// <summary>
89-
/// Error contract returned when some exception occurs in ASR REST API.
90+
/// ARM specified Error
9091
/// </summary>
91-
[SuppressMessage(
92+
public class ARMError
93+
{
94+
/// <summary>
95+
/// Gets ARM formatted exception.
96+
/// </summary>
97+
[JsonProperty(PropertyName = "error")]
98+
public ARMException Error { get; private set; }
99+
}
100+
101+
/// <summary>
102+
/// ARM exception class.
103+
/// </summary>
104+
[System.Diagnostics.CodeAnalysis.SuppressMessage(
92105
"Microsoft.StyleCop.CSharp.MaintainabilityRules",
93106
"SA1402:FileMayOnlyContainASingleClass",
94-
Justification = "Keeping all contracts together.")]
95-
[DataContract]
96-
public class ErrorInException : Error
107+
Justification = "Keeping all related classes together.")]
108+
public class ARMException
109+
{
110+
/// <summary>
111+
/// Gets HTTP status code for the error.
112+
/// </summary>
113+
[JsonProperty(PropertyName = "code")]
114+
public string ErrorCode { get; private set; }
115+
116+
/// <summary>
117+
/// Gets exception message.
118+
/// </summary>
119+
[JsonProperty(PropertyName = "message")]
120+
public string Message { get; private set; }
121+
122+
/// <summary>
123+
/// Gets exception target.
124+
/// </summary>
125+
[JsonProperty(PropertyName = "target",
126+
NullValueHandling = NullValueHandling.Ignore,
127+
DefaultValueHandling = DefaultValueHandling.Ignore)]
128+
public string Target { get; private set; }
129+
130+
/// <summary>
131+
/// Gets service based error details.
132+
/// </summary>
133+
[JsonProperty(PropertyName = "details")]
134+
public List<ARMExceptionDetails> Details { get; private set; }
135+
}
136+
137+
/// <summary>
138+
/// Service based exception details.
139+
/// </summary>
140+
public class ARMExceptionDetails
97141
{
142+
/// <summary>
143+
/// Gets service error code.
144+
/// </summary>
145+
[JsonProperty(PropertyName = "code")]
146+
public string ErrorCode { get; private set; }
147+
148+
/// <summary>
149+
/// Gets error message.
150+
/// </summary>
151+
[JsonProperty(PropertyName = "message")]
152+
public string Message { get; private set; }
153+
154+
/// <summary>
155+
/// Gets possible cause for error.
156+
/// </summary>
157+
[JsonProperty(PropertyName = "possibleCauses",
158+
NullValueHandling = NullValueHandling.Ignore,
159+
DefaultValueHandling = DefaultValueHandling.Ignore)]
160+
public string PossibleCauses { get; private set; }
161+
162+
/// <summary>
163+
/// Gets recommended action for the error.
164+
/// </summary>
165+
[JsonProperty(PropertyName = "recommendedAction",
166+
NullValueHandling = NullValueHandling.Ignore,
167+
DefaultValueHandling = DefaultValueHandling.Ignore)]
168+
public string RecommendedAction { get; private set; }
169+
170+
/// <summary>
171+
/// Gets the client request Id for the session.
172+
/// </summary>
173+
[JsonProperty(PropertyName = "clientRequestId",
174+
NullValueHandling = NullValueHandling.Ignore,
175+
DefaultValueHandling = DefaultValueHandling.Ignore)]
176+
public string ClientRequestId { get; private set; }
177+
178+
/// <summary>
179+
/// Gets the activity Id for the session.
180+
/// </summary>
181+
[JsonProperty(PropertyName = "activityId")]
182+
public string ActivityId { get; private set; }
183+
184+
/// <summary>
185+
/// Gets exception target.
186+
/// </summary>
187+
[JsonProperty(PropertyName = "target",
188+
NullValueHandling = NullValueHandling.Ignore,
189+
DefaultValueHandling = DefaultValueHandling.Ignore)]
190+
public string Target { get; private set; }
98191
}
99192

100193
/// <summary>

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Properties/Resources.Designer.cs

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Properties/Resources.resx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@
119119
</resheader>
120120
<data name="CloudExceptionDetails" xml:space="preserve">
121121
<value>Operation Failed.
122-
Message: {0}
123-
Possible Causes: {1}
124-
Recommended Action: {2}
125-
ClientRequestId: {3}</value>
122+
</value>
126123
</data>
127124
<data name="CloudServiceNameNullOrEmpty" xml:space="preserve">
128125
<value>Cloud Service name mentioned is either null or empty</value>

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/Vault/NewAzureRMRecoveryServicesVault.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public class NewAzureRmRecoveryServicesVault : RecoveryServicesCmdletBase
3434
public string Name { get; set; }
3535

3636
/// <summary>
37-
/// Gets or sets the resouce group name
37+
/// Gets or sets the resource group name
3838
/// </summary>
3939
[Parameter(Mandatory = true)]
4040
[ValidateNotNullOrEmpty]
41-
public string ResouceGroupName { get; set; }
41+
public string ResourceGroupName { get; set; }
4242

4343
/// <summary>
4444
/// Gets or sets the location of the vault
@@ -62,7 +62,7 @@ public override void ExecuteCmdlet()
6262
vaultCreateArgs.Sku = new VaultSku();
6363
vaultCreateArgs.Sku.Name = "standard";
6464

65-
VaultCreateResponse response = RecoveryServicesClient.CreateVault(this.ResouceGroupName, this.Name, vaultCreateArgs);
65+
VaultCreateResponse response = RecoveryServicesClient.CreateVault(this.ResourceGroupName, this.Name, vaultCreateArgs);
6666

6767
this.WriteObject(new ARSVault(response));
6868
}

src/ResourceManager/RecoveryServices/Commands.RecoveryServices/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Authentication" version="1.5.1-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
7-
<package id="Microsoft.Azure.Management.RecoveryServices" version="1.0.1-preview" targetFramework="net45" />
7+
<package id="Microsoft.Azure.Management.RecoveryServices" version="1.0.2-preview" targetFramework="net45" />
88
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
99
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
1010
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />

0 commit comments

Comments
 (0)