private void ExecuteDeployment() { if (RollbackToLastDeployment && !string.IsNullOrEmpty(RollBackDeploymentName)) { WriteExceptionError(new ArgumentException(ProjectResources.InvalidRollbackParameters)); } var parameters = new PSDeploymentCmdletParameters() { ScopeType = DeploymentScopeType.ResourceGroup, ResourceGroupName = ResourceGroupName, DeploymentName = Name, DeploymentMode = Mode, TemplateFile = TemplateUri ?? this.TryResolvePath(TemplateFile), TemplateObject = TemplateObject, TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject), ParameterUri = TemplateParameterUri, DeploymentDebugLogLevel = GetDeploymentDebugLogLevel(DeploymentDebugLogLevel), Tags = TagsHelper.ConvertToTagsDictionary(Tag), OnErrorDeployment = RollbackToLastDeployment || !string.IsNullOrEmpty(RollBackDeploymentName) ? new OnErrorDeployment { Type = RollbackToLastDeployment ? OnErrorDeploymentType.LastSuccessful : OnErrorDeploymentType.SpecificDeployment, DeploymentName = RollbackToLastDeployment ? null : RollBackDeploymentName } : null }; if (!string.IsNullOrEmpty(parameters.DeploymentDebugLogLevel)) { WriteWarning(ProjectResources.WarnOnDeploymentDebugSetting); } WriteObject(ResourceManagerSdkClient.ExecuteResourceGroupDeployment(parameters)); }
public override void ExecuteCmdlet() { this.ConfirmAction( this.Force, string.Format(ProjectResources.ConfirmOnCompleteDeploymentMode, this.ResourceGroupName), ProjectResources.CreateDeployment, ResourceGroupName, () => { if (RollbackToLastDeployment && !string.IsNullOrEmpty(RollBackDeploymentName)) { WriteExceptionError(new ArgumentException(ProjectResources.InvalidRollbackParameters)); } var parameters = new PSDeploymentCmdletParameters() { ScopeType = DeploymentScopeType.ResourceGroup, ResourceGroupName = ResourceGroupName, DeploymentName = Name, DeploymentMode = Mode, TemplateFile = TemplateUri ?? this.TryResolvePath(TemplateFile), TemplateObject = TemplateObject, TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject), ParameterUri = TemplateParameterUri, DeploymentDebugLogLevel = GetDeploymentDebugLogLevel(DeploymentDebugLogLevel), OnErrorDeployment = RollbackToLastDeployment || !string.IsNullOrEmpty(RollBackDeploymentName) ? new OnErrorDeployment { Type = RollbackToLastDeployment ? OnErrorDeploymentType.LastSuccessful : OnErrorDeploymentType.SpecificDeployment, DeploymentName = RollbackToLastDeployment ? null : RollBackDeploymentName } : null }; if (!string.IsNullOrEmpty(parameters.DeploymentDebugLogLevel)) { WriteWarning(ProjectResources.WarnOnDeploymentDebugSetting); } WriteObject(ResourceManagerSdkClient.ExecuteResourceGroupDeployment(parameters)); }, () => this.Mode == DeploymentMode.Complete); }