private object UpdateUIAzureLogicAppsResourcesAsync(OperationRunner context)
        {
            string tempArmTemplateFilePath           = System.IO.Path.Combine(DataModel.InstallationConfiguration.Azure.ArmTempPath, System.IO.Path.GetFileName(LogicAppsConfiguration.LogicAppsArmTemplateFileName));
            string tempArmTemplateParametersFilePath = System.IO.Path.Combine(DataModel.InstallationConfiguration.Azure.ArmTempPath, System.IO.Path.GetFileName(LogicAppsConfiguration.LogicAppsArmTemplateParametersFileName));

            File.Copy(
                LogicAppsConfiguration.LogicAppsArmTemplateFilePath,
                tempArmTemplateFilePath,
                true);

            DataModel.InstallationConfiguration.PowerApps.SaveConfiguration();
            DataModel.InstallationConfiguration.Azure.SaveConfiguration(new Dictionary <string, string>()
            {
                { LogicAppsConfiguration.LogicAppsArmTemplateParametersFilePath, tempArmTemplateParametersFilePath },
            });

            AzureClient client = new AzureClient(WizardContext.TokenProvider);

            client.SetLogger(context.Logger);

            return(client.CreateResourceGroupDeployment(
                       DataModel.InstallationConfiguration.Azure.SelectedSubscription.Id,
                       DataModel.InstallationConfiguration.Azure.ResourceGroupName,
                       $"UI_Update_Deployment_{Guid.NewGuid().ToString()}",
                       tempArmTemplateFilePath,
                       tempArmTemplateParametersFilePath));
        }
Esempio n. 2
0
        private object DeployAPIAzureResourcesAsync(OperationRunner context)
        {
            string tempArmTemplateFilePath           = System.IO.Path.Combine(DataModel.InstallationConfiguration.Azure.ArmTempPath, System.IO.Path.GetFileName(AzureConfiguration.AzureArmTemplateFilePath));
            string tempArmTemplateParametersFilePath = System.IO.Path.Combine(DataModel.InstallationConfiguration.Azure.ArmTempPath, System.IO.Path.GetFileName(AzureConfiguration.AzureArmTemplateParametersFilePath));

            File.Copy(
                AzureConfiguration.AzureArmTemplateFilePath,
                tempArmTemplateFilePath,
                true);

            // TODO: Do this better
            // if (!string.IsNullOrWhiteSpace(DataModel.InstallationStatusCache.Status.FunctionApp.ClientSecret)) DataModel.InstallationConfiguration.Azure.FunctionApp.ApplicationRegistrationSecret = new NetworkCredential("applicationRegistrationSecret", DataModel.InstallationStatusCache.Status.FunctionApp.ClientSecret);
            DataModel.InstallationConfiguration.Azure.LogicApps.AADClientId = DataModel.InstallationConfiguration.Azure.FunctionApp.ApplicationId;
            DataModel.InstallationConfiguration.Azure.LogicApps.AADAudience = DataModel.InstallationConfiguration.Azure.FunctionApp.ApplicationId;

            DataModel.InstallationConfiguration.PowerApps.SaveConfiguration();
            DataModel.InstallationConfiguration.Azure.SaveConfiguration(new Dictionary <string, string>()
            {
                { AzureConfiguration.AzureArmTemplateParametersFilePath, tempArmTemplateParametersFilePath },
            });

            AzureClient client = new AzureClient(WizardContext.TokenProvider);

            client.SetLogger(context.Logger);

            return(client.CreateResourceGroupDeployment(
                       DataModel.InstallationConfiguration.Azure.SelectedSubscription.Id,
                       DataModel.InstallationConfiguration.Azure.ResourceGroupName,
                       $"API_Deployment_{Guid.NewGuid().ToString()}",
                       tempArmTemplateFilePath,
                       tempArmTemplateParametersFilePath));
        }