コード例 #1
0
        public async Task <PartialViewResult> NewDeployment(NewDeploymentModel model)
        {
            AuthenticationResult   token;
            List <DeploymentModel> results;

            try
            {
                token = await GetAccessTokenAsync(
                    $"{Provider.Configuration.ActiveDirectoryEndpoint}/{model.CustomerId}").ConfigureAwait(false);

                using (ResourceManager manager = new ResourceManager(Provider, token.AccessToken))
                {
                    await manager.ApplyTemplateAsync(
                        model.SubscriptionId,
                        model.ResourceGroupName,
                        model.TemplateUri,
                        model.ParametersUri).ConfigureAwait(false);

                    results = await GetDeploymentsAsync(
                        model.CustomerId,
                        model.ResourceGroupName,
                        model.SubscriptionId).ConfigureAwait(false);

                    return(PartialView("Deployments", results));
                }
            }
            finally
            {
                results = null;
                token   = null;
            }
        }
コード例 #2
0
        public async Task <PartialViewResult> NewDeployment(NewDeploymentModel model)
        {
            AuthenticationToken    token;
            List <DeploymentModel> results;

            try
            {
                token = await this.Service.TokenManagement.GetAppPlusUserTokenAsync(
                    $"{this.Service.Configuration.ActiveDirectoryEndpoint}/{model.CustomerId}",
                    this.Service.Configuration.AzureResourceManagerEndpoint);

                using (ResourceManager manager = new ResourceManager(this.Service, token.Token))
                {
                    await manager.ApplyTemplateAsync(
                        model.SubscriptionId,
                        model.ResourceGroupName,
                        model.TemplateUri,
                        model.ParametersUri);

                    results = await this.GetDeploymentsAsync(model.CustomerId, model.ResourceGroupName, model.SubscriptionId);

                    return(this.PartialView("Deployments", results));
                }
            }
            finally
            {
                results = null;
                token   = null;
            }
        }
コード例 #3
0
        public async Task <PartialViewResult> NewDeployment(NewDeploymentModel model)
        {
            AuthenticationResult   token;
            List <DeploymentModel> results;

            try
            {
                token = await TokenContext.GetAADTokenAsync(
                    $"{AppConfig.Authority}/{model.CustomerId}",
                    AppConfig.ManagementUri
                    );

                using (ResourceManager manager = new ResourceManager(token.AccessToken))
                {
                    await manager.ApplyTemplateAsync(
                        model.SubscriptionId,
                        model.ResourceGroupName,
                        model.TemplateUri,
                        model.ParametersUri
                        );

                    results = await GetDeploymentsAsync(model.CustomerId, model.ResourceGroupName, model.SubscriptionId);

                    return(PartialView("Deployments", results));
                }
            }
            finally
            {
                results = null;
                token   = null;
            }
        }
コード例 #4
0
        public PartialViewResult NewDeployment(string customerId, string resourceGroupName, string subscriptionId)
        {
            NewDeploymentModel newDeploymentModel = new NewDeploymentModel()
            {
                CustomerId        = customerId,
                ResourceGroupName = resourceGroupName,
                SubscriptionId    = subscriptionId
            };

            return(PartialView(newDeploymentModel));
        }