public DeploymentExtended CreateClassicRegistry(
            string resourceGroupName,
            string registryName,
            string location,
            bool?adminUserEnabled,
            IDictionary <string, string> tags = null)
        {
            var storageAccountName = registryName.ToLowerInvariant();

            if (storageAccountName.Length > 18)
            {
                storageAccountName = storageAccountName.Substring(0, 18);
            }
            storageAccountName += DateTime.UtcNow.ToString("hhmmss");

            var        deploymentName = $"ContainerRegistry_{registryName}";
            Deployment deployment     = new Deployment()
            {
                Properties = new DeploymentProperties()
                {
                    Template = DeploymentTemplateHelper.DeploymentTemplateNewStorage(
                        registryName, location, SkuName.Classic, storageAccountName, adminUserEnabled),
                    Mode = DeploymentMode.Incremental
                }
            };

            return(_client.Deployments.CreateOrUpdate(resourceGroupName, deploymentName, deployment));
        }
        public DeploymentExtended CreateRegistry(
            string resourceGroupName,
            string registryName,
            string location,
            string registrySku,
            bool?adminUserEnabled,
            string storageAccountName         = null,
            IDictionary <string, string> tags = null)
        {
            string template = null;

            if (storageAccountName == null)
            {
                storageAccountName = registryName.ToLowerInvariant();
                if (storageAccountName.Length > 18)
                {
                    storageAccountName = storageAccountName.Substring(0, 18);
                }
                storageAccountName += DateTime.UtcNow.ToString("hhmmss");

                template = DeploymentTemplateHelper.DeploymentTemplateNewStorage(
                    registryName, location, registrySku, storageAccountName, adminUserEnabled);
            }
            else
            {
                var storageAccountResourceGroup = GetStorageAccountResourceGroup(storageAccountName);

                template = DeploymentTemplateHelper.DeploymentTemplateExistingStorage(
                    registryName, location, registrySku, storageAccountName, storageAccountResourceGroup, adminUserEnabled);
            }

            var        deploymentName = $"ContainerRegistry_{registryName}";
            Deployment deployment     = new Deployment()
            {
                Properties = new DeploymentProperties()
                {
                    Template = template,
                    Mode     = DeploymentMode.Incremental
                }
            };

            ResourceManagementClient.Deployments.BeginCreateOrUpdate(resourceGroupName, deploymentName, deployment);
            return(ProvisionDeploymentStatus(resourceGroupName, deploymentName, deployment));
        }