Skip to content

Commit 842678b

Browse files
committed
Merge pull request Azure#1170 from vivsriaus/NestedTemplate
Emit nested deployment operation statuses when submitting templates w…
2 parents e523a2c + a7d4aa0 commit 842678b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Components/Constants.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ public static class Constants
6969
/// </summary>
7070
public static readonly string MicrosoftResourcesDeploymentOperationsType = Constants.MicrosoftResourceNamesapce + "/deployments/operations";
7171

72+
/// <summary>
73+
/// The deployments resource type.
74+
/// </summary>
75+
public static readonly string MicrosoftResourcesDeploymentType = Constants.MicrosoftResourceNamesapce + "/deployments";
76+
7277
/// <summary>
7378
/// The policy definition resource type.
7479
/// </summary>

src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using System.Threading.Tasks;
2323
using Hyak.Common;
2424
using Microsoft.Azure.Commands.Resources.Models.Authorization;
25+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
2526
using Microsoft.Azure.Commands.Tags.Model;
2627
using Microsoft.Azure.Common.Authentication;
2728
using Microsoft.Azure.Common.Authentication.Models;
@@ -335,6 +336,21 @@ private List<DeploymentOperation> GetNewOperations(List<DeploymentOperation> old
335336
{
336337
newOperations.Add(operation);
337338
}
339+
340+
//If nested deployment, get the operations under those deployments as well
341+
if(operation.Properties.TargetResource.ResourceType.Equals(Constants.MicrosoftResourcesDeploymentType, StringComparison.OrdinalIgnoreCase))
342+
{
343+
List<DeploymentOperation> newNestedOperations = new List<DeploymentOperation>();
344+
DeploymentOperationsListResult result;
345+
346+
result = ResourceManagementClient.DeploymentOperations.List(
347+
resourceGroupName: ResourceIdUtility.GetResourceGroupName(operation.Properties.TargetResource.Id),
348+
deploymentName: operation.Properties.TargetResource.ResourceName,
349+
parameters: null);
350+
351+
newNestedOperations = GetNewOperations(operations, result.Operations);
352+
newOperations.AddRange(newNestedOperations);
353+
}
338354
}
339355

340356
return newOperations;

0 commit comments

Comments
 (0)