public async Task CreateDeploymentsUsingJsonElement()
        {
            #region Snippet:Managing_Deployments_CreateADeploymentUsingJsonElement
            // First we need to get the deployment collection from the resource group
            ArmDeploymentCollection ArmDeploymentCollection = resourceGroup.GetArmDeployments();
            // Use the same location as the resource group
            string deploymentName = "myDeployment";
            // Create a parameter object
            var parametersObject = new { storageAccountType = new { value = "Standard_GRS" } };
            //convert this object to JsonElement
            var parametersString = JsonSerializer.Serialize(parametersObject);
            var parameters       = JsonDocument.Parse(parametersString).RootElement;
            var input            = new ArmDeploymentInput(new ArmDeploymentProperties(ArmDeploymentMode.Incremental)
            {
                TemplateLink = new ArmDeploymentTemplateLink()
                {
                    Uri = new Uri("https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.storage/storage-account-create/azuredeploy.json")
                },
                Parameters = BinaryData.FromString(parameters.GetRawText())
            });
            ArmOperation <ArmDeploymentResource> lro = await ArmDeploymentCollection.CreateOrUpdateAsync(WaitUntil.Completed, deploymentName, input);

            ArmDeploymentResource deployment = lro.Value;
            #endregion Snippet:Managing_Deployments_CreateADeployment
        }
        public async Task CreateDeployments()
        {
            #region Snippet:Managing_Deployments_CreateADeployment
            // First we need to get the deployment collection from the resource group
            ArmDeploymentCollection ArmDeploymentCollection = resourceGroup.GetArmDeployments();
            // Use the same location as the resource group
            string deploymentName = "myDeployment";
            var    input          = new ArmDeploymentInput(new ArmDeploymentProperties(ArmDeploymentMode.Incremental)
            {
                TemplateLink = new ArmDeploymentTemplateLink()
                {
                    Uri = new Uri("https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.storage/storage-account-create/azuredeploy.json")
                },
                Parameters = BinaryData.FromObjectAsJson(new JsonObject()
                {
                    { "storageAccountType", new JsonObject()
                      {
                          { "value", "Standard_GRS" }
                      } }
                })
            });
            ArmOperation <ArmDeploymentResource> lro = await ArmDeploymentCollection.CreateOrUpdateAsync(WaitUntil.Completed, deploymentName, input);

            ArmDeploymentResource deployment = lro.Value;
            #endregion Snippet:Managing_Deployments_CreateADeployment
        }
        public async Task CreateDeploymentsUsingString()
        {
            #region Snippet:Managing_Deployments_CreateADeploymentUsingString
            // First we need to get the deployment collection from the resource group
            ArmDeploymentCollection ArmDeploymentCollection = resourceGroup.GetArmDeployments();
            // Use the same location as the resource group
            string deploymentName = "myDeployment";
            // Passing string to template and parameters
            var input = new ArmDeploymentInput(new ArmDeploymentProperties(ArmDeploymentMode.Incremental)
            {
                Template   = BinaryData.FromString(File.ReadAllText("storage-template.json")),
                Parameters = BinaryData.FromString(File.ReadAllText("storage-parameters.json"))
            });
            ArmOperation <ArmDeploymentResource> lro = await ArmDeploymentCollection.CreateOrUpdateAsync(WaitUntil.Completed, deploymentName, input);

            ArmDeploymentResource deployment = lro.Value;
            #endregion Snippet:Managing_Deployments_CreateADeployment
        }
        public virtual ArmOperation <ArmDeploymentResource> CreateOrUpdate(WaitUntil waitUntil, string deploymentName, ArmDeploymentInput parameters, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName));
            Argument.AssertNotNull(parameters, nameof(parameters));

            using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response  = _armDeploymentDeploymentsRestClient.CreateOrUpdateAtScope(Id, deploymentName, parameters, cancellationToken);
                var operation = new ResourcesArmOperation <ArmDeploymentResource>(new ArmDeploymentOperationSource(Client), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateCreateOrUpdateAtScopeRequest(Id, deploymentName, parameters).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }