|
23 | 23 | using Hyak.Common;
|
24 | 24 | using Microsoft.Azure.Commands.Resources.Models.Authorization;
|
25 | 25 | using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
|
| 26 | +using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities; |
26 | 27 | using Microsoft.Azure.Commands.Tags.Model;
|
27 | 28 | using Microsoft.Azure.Common.Authentication;
|
28 | 29 | using Microsoft.Azure.Common.Authentication.Models;
|
|
34 | 35 | using Microsoft.WindowsAzure.Commands.Utilities.Common;
|
35 | 36 | using Newtonsoft.Json;
|
36 | 37 | using ProjectResources = Microsoft.Azure.Commands.Resources.Properties.Resources;
|
| 38 | +using System.Net; |
37 | 39 |
|
38 | 40 | namespace Microsoft.Azure.Commands.Resources.Models
|
39 | 41 | {
|
@@ -338,19 +340,23 @@ private List<DeploymentOperation> GetNewOperations(List<DeploymentOperation> old
|
338 | 340 | }
|
339 | 341 |
|
340 | 342 | //If nested deployment, get the operations under those deployments as well
|
341 |
| - if(operation.Properties.TargetResource.ResourceType.Equals(Constants.MicrosoftResourcesDeploymentType, StringComparison.OrdinalIgnoreCase) |
342 |
| - && !operation.Properties.StatusCode.Equals("BadRequest", StringComparison.OrdinalIgnoreCase)) |
| 343 | + if(operation.Properties.TargetResource.ResourceType.Equals(Constants.MicrosoftResourcesDeploymentType, StringComparison.OrdinalIgnoreCase)) |
343 | 344 | {
|
344 |
| - List<DeploymentOperation> newNestedOperations = new List<DeploymentOperation>(); |
345 |
| - DeploymentOperationsListResult result; |
| 345 | + HttpStatusCode statusCode; |
| 346 | + Enum.TryParse<HttpStatusCode>(operation.Properties.StatusCode, out statusCode); |
| 347 | + if(!statusCode.IsClientFailureRequest()) |
| 348 | + { |
| 349 | + List<DeploymentOperation> newNestedOperations = new List<DeploymentOperation>(); |
| 350 | + DeploymentOperationsListResult result; |
346 | 351 |
|
347 |
| - result = ResourceManagementClient.DeploymentOperations.List( |
348 |
| - resourceGroupName: ResourceIdUtility.GetResourceGroupName(operation.Properties.TargetResource.Id), |
349 |
| - deploymentName: operation.Properties.TargetResource.ResourceName, |
350 |
| - parameters: null); |
| 352 | + result = ResourceManagementClient.DeploymentOperations.List( |
| 353 | + resourceGroupName: ResourceIdUtility.GetResourceGroupName(operation.Properties.TargetResource.Id), |
| 354 | + deploymentName: operation.Properties.TargetResource.ResourceName, |
| 355 | + parameters: null); |
351 | 356 |
|
352 |
| - newNestedOperations = GetNewOperations(operations, result.Operations); |
353 |
| - newOperations.AddRange(newNestedOperations); |
| 357 | + newNestedOperations = GetNewOperations(operations, result.Operations); |
| 358 | + newOperations.AddRange(newNestedOperations); |
| 359 | + } |
354 | 360 | }
|
355 | 361 | }
|
356 | 362 |
|
|
0 commit comments