public async virtual Task <DeploymentCreateOrUpdateAtScopeOperation> CreateOrUpdateAsync(string deploymentName, DeploymentInput parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (deploymentName == null) { throw new ArgumentNullException(nameof(deploymentName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("DeploymentCollection.CreateOrUpdate"); scope.Start(); try { var response = await _deploymentsRestClient.CreateOrUpdateAtScopeAsync(Id, deploymentName, parameters, cancellationToken).ConfigureAwait(false); var operation = new DeploymentCreateOrUpdateAtScopeOperation(Parent, _clientDiagnostics, Pipeline, _deploymentsRestClient.CreateCreateOrUpdateAtScopeRequest(Id, deploymentName, parameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async Task CreateDeployments() { #region Snippet:Managing_Deployments_CreateADeployment // First we need to get the deployment collection from the resource group DeploymentCollection deploymentCollection = resourceGroup.GetDeployments(); // Use the same location as the resource group string deploymentName = "myDeployment"; var input = new DeploymentInput(new DeploymentProperties(DeploymentMode.Incremental) { TemplateLink = new TemplateLink() { Uri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.storage/storage-account-create/azuredeploy.json" }, Parameters = new JsonObject() { { "storageAccountType", new JsonObject() { { "value", "Standard_GRS" } } } } }); DeploymentCreateOrUpdateAtScopeOperation lro = await deploymentCollection.CreateOrUpdateAsync(deploymentName, input); Deployment deployment = lro.Value; #endregion Snippet:Managing_Deployments_CreateADeployment }
public virtual DeploymentCreateOrUpdateAtScopeOperation CreateOrUpdate(string deploymentName, Deployment parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (deploymentName == null) { throw new ArgumentNullException(nameof(deploymentName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdateAtScope(Id, deploymentName, parameters, cancellationToken); var operation = new DeploymentCreateOrUpdateAtScopeOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateAtScopeRequest(Id, deploymentName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }