protected override void OnProcessRecord() { string whatIfMessage = this.ShouldExecuteWhatIf() ? this.ExecuteWhatIf() : null; string warningMessage = $"{Environment.NewLine}{ProjectResources.ConfirmDeploymentMessage}"; string captionMessage = $"{(char)27}[1A{Color.Reset}{whatIfMessage}"; // {(char)27}[1A for cursor up. if (ShouldProcess(whatIfMessage, warningMessage, captionMessage)) { var parameters = new PSDeploymentCmdletParameters() { ScopeType = DeploymentScopeType.Subscription, Location = Location, DeploymentName = Name, DeploymentMode = DeploymentMode.Incremental, TemplateFile = TemplateUri ?? this.TryResolvePath(TemplateFile), TemplateObject = TemplateObject, TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject), ParameterUri = TemplateParameterUri, DeploymentDebugLogLevel = GetDeploymentDebugLogLevel(DeploymentDebugLogLevel), Tags = TagsHelper.ConvertToTagsDictionary(Tag) }; if (!string.IsNullOrEmpty(parameters.DeploymentDebugLogLevel)) { WriteWarning(ProjectResources.WarnOnDeploymentDebugSetting); } WriteObject(ResourceManagerSdkClient.ExecuteDeployment(parameters)); } }
public override void ExecuteCmdlet() { this.ConfirmAction( this.Force, string.Format(ProjectResources.ConfirmOnCompleteDeploymentMode, this.ResourceGroupName), ProjectResources.CreateDeployment, ResourceGroupName, () => { PSCreateResourceGroupDeploymentParameters parameters = new PSCreateResourceGroupDeploymentParameters() { ResourceGroupName = ResourceGroupName, DeploymentName = Name, DeploymentMode = Mode, TemplateFile = TemplateUri ?? this.TryResolvePath(TemplateFile), TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject), ParameterUri = TemplateParameterUri, DeploymentDebugLogLevel = GetDeploymentDebugLogLevel(DeploymentDebugLogLevel) }; if (!string.IsNullOrEmpty(parameters.DeploymentDebugLogLevel)) { WriteWarning(ProjectResources.WarnOnDeploymentDebugSetting); } WriteObject(ResourceManagerSdkClient.ExecuteDeployment(parameters)); }, () => this.Mode == DeploymentMode.Complete); }
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() { 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.ExecuteDeployment(parameters)); }, () => this.Mode == DeploymentMode.Complete); }
protected override void OnProcessRecord() { var parameters = new PSDeploymentCmdletParameters() { ScopeType = DeploymentScopeType.Tenant, Location = this.Location, DeploymentName = this.Name, DeploymentMode = DeploymentMode.Incremental, TemplateFile = TemplateUri ?? this.TryResolvePath(TemplateFile), TemplateObject = TemplateObject, TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject), ParameterUri = TemplateParameterUri, DeploymentDebugLogLevel = GetDeploymentDebugLogLevel(DeploymentDebugLogLevel) }; if (!string.IsNullOrEmpty(parameters.DeploymentDebugLogLevel)) { WriteWarning(ProjectResources.WarnOnDeploymentDebugSetting); } WriteObject(ResourceManagerSdkClient.ExecuteDeployment(parameters)); }