//Subscription deployment mode public ArmDeployment(string CorrelationId, DateTime?TimeStamp, string ProvisioningState, string ResourceGroupName, string DeploymentName, Microsoft.Azure.Management.ResourceManager.Models.DeploymentExtended deployment) { if (null == DeploymentOps) { this.DeploymentOps = new List <DeploymentOp>(); } this.CorrelationId = CorrelationId; this.ProvisioningState = ProvisioningState; this.Timestamp = TimeStamp; this.ResourceGroupName = ResourceGroupName; this.DeploymentName = DeploymentName; var allDeployments = deployment.Properties.OutputResources; this.Template = deployment.Properties.TemplateHash; foreach (var h in allDeployments) { var thisDeployment = new DeploymentOp() { ProvisioningState = null, StatusMessage = null, Id = h.Id, ResourceName = null, ResourceType = null }; this.DeploymentOps.Add(thisDeployment); } }
//RG deployment mode public ArmDeployment(string CorrelationId, DateTime?TimeStamp, string ProvisioningState, string ResourceGroupName, string DeploymentName, IDeployment deployment) { if (null == DeploymentOps) { this.DeploymentOps = new List <DeploymentOp>(); } this.CorrelationId = CorrelationId; this.ProvisioningState = ProvisioningState; this.Timestamp = TimeStamp; this.ResourceGroupName = ResourceGroupName; this.DeploymentName = DeploymentName; var allDeployments = deployment?.DeploymentOperations?.List(); this.Template = deployment.Template; foreach (var h in allDeployments) { var thisDeployment = new DeploymentOp() { ProvisioningState = h.ProvisioningState, StatusMessage = h.StatusCode, Id = h.TargetResource?.Id, ResourceName = h.TargetResource?.ResourceName, ResourceType = h.TargetResource?.ResourceType }; this.DeploymentOps.Add(thisDeployment); } }