From 34170fa660c7d1ec31118c5f6ccc230ab4f13d5d Mon Sep 17 00:00:00 2001 From: Eavanshi Arora <52486630+eaarora-ms@users.noreply.github.com> Date: Tue, 27 Aug 2019 11:01:49 +0530 Subject: [PATCH] App Service Settings Changes (#11211) * App Service Settings Changes * Code owners added --- .github/CODEOWNERS | 2 ++ Tasks/AzureAppServiceSettingsV1/README.md | 2 +- .../resources.resjson/en-US/resources.resjson | 15 ++++++----- .../azurewebappsettings.ts | 8 ++++-- Tasks/AzureAppServiceSettingsV1/task.json | 22 +++++++++------- Tasks/AzureAppServiceSettingsV1/task.loc.json | 26 ++++++++++--------- 6 files changed, 43 insertions(+), 32 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index bacd30297f91..36663486f367 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -19,6 +19,8 @@ Tasks/ArchiveFilesV2/* @bryanmacfarlane Tasks/AzureAppServiceManageV0/* @kmkumaran @SumiranAgg @vincentdass +Tasks/AzureAppServiceSettingsV1/* @eaarora-ms @SumiranAgg @vincentdass @niadak + Tasks/AzureCLIV1/* @sachinma Tasks/AzureCloudPowerShellDeploymentV1/* @kmkumaran diff --git a/Tasks/AzureAppServiceSettingsV1/README.md b/Tasks/AzureAppServiceSettingsV1/README.md index 83c34432030d..c9d78978a53a 100644 --- a/Tasks/AzureAppServiceSettingsV1/README.md +++ b/Tasks/AzureAppServiceSettingsV1/README.md @@ -95,7 +95,7 @@ steps: displayName: 'Azure App Service Settings: demo_webapp' inputs: azureSubscription: demo_subscription_id - WebAppName: demo_webapp + appName: demo_webapp appSettings: | [ { "name": "key1", "value": "valueabcd", "slotSetting": false }, { "name": "key2", "value": "valueefgh", "slotSetting": true } ] generalSettings: | diff --git a/Tasks/AzureAppServiceSettingsV1/Strings/resources.resjson/en-US/resources.resjson b/Tasks/AzureAppServiceSettingsV1/Strings/resources.resjson/en-US/resources.resjson index 833df6704a42..751978d74d5e 100644 --- a/Tasks/AzureAppServiceSettingsV1/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/AzureAppServiceSettingsV1/Strings/resources.resjson/en-US/resources.resjson @@ -1,15 +1,15 @@ { "loc.friendlyName": "Azure App Service Settings", - "loc.helpMarkDown": "[Learn more about this task](https://aka.ms/azurewebappdeployreadme)", + "loc.helpMarkDown": "[Learn more about this task](https://aka.ms/AA5wsgy)", "loc.description": "Update/Add App settings an Azure Web App for Linux or Windows", - "loc.instanceNameFormat": "Azure App Service Settings: $(WebAppName)", + "loc.instanceNameFormat": "Azure App Service Settings: $(appName)", "loc.group.displayName.ApplicationAndConfigurationSettings": "Application and Configuration Settings", "loc.input.label.ConnectedServiceName": "Azure subscription", "loc.input.help.ConnectedServiceName": "Select the Azure Resource Manager subscription", - "loc.input.label.WebAppName": "App Service name", - "loc.input.help.WebAppName": "Enter or Select the name of an existing Azure App Service", - "loc.input.label.ResourceGroupName": "Resource group", - "loc.input.help.ResourceGroupName": "Enter or Select the Azure Resource Group that contains the Azure App Service specified above", + "loc.input.label.appName": "App Service name", + "loc.input.help.appName": "Enter or Select the name of an existing Azure App Service", + "loc.input.label.resourceGroupName": "Resource group", + "loc.input.help.resourceGroupName": "Enter or Select the Azure Resource Group that contains the Azure App Service specified above", "loc.input.label.slotName": "Slot", "loc.input.help.slotName": "Enter or Select an existing Slot. If no slot is selected, changes will be made to production.", "loc.input.label.appSettings": "App settings", @@ -39,5 +39,6 @@ "loc.messages.FailedToUpdateAppServiceConfiguration": "Failed to update App service '%s' configuration. Error: %s", "loc.messages.FailedToGetAppServiceConfiguration": "Failed to get App service '%s' configuration. Error: %s", "loc.messages.FailedToGetAppServicePublishingCredentials": "Failed to fetch App Service '%s' publishing credentials. Error: %s", - "loc.messages.FailedToGetAppServiceApplicationSettings": "Failed to get App service '%s' application settings. Error: %s" + "loc.messages.FailedToGetAppServiceApplicationSettings": "Failed to get App service '%s' application settings. Error: %s", + "loc.messages.AppServiceSettingsNotEnabled": "App Service Settings is not enabled. Please provide one of the following : App Settings or General Settings or Connection Strings." } \ No newline at end of file diff --git a/Tasks/AzureAppServiceSettingsV1/azurewebappsettings.ts b/Tasks/AzureAppServiceSettingsV1/azurewebappsettings.ts index 145f06e39ac2..e748c525d972 100644 --- a/Tasks/AzureAppServiceSettingsV1/azurewebappsettings.ts +++ b/Tasks/AzureAppServiceSettingsV1/azurewebappsettings.ts @@ -32,13 +32,17 @@ async function main() { tl.setResourcePath(path.join( __dirname, 'task.json')); tl.setResourcePath(path.join( __dirname, 'node_modules/azurermdeploycommon/module.json')); var connectedServiceName = tl.getInput('ConnectedServiceName', true); - var webAppName: string = tl.getInput('WebAppName', true); - var resourceGroupName: string = tl.getInput('ResourceGroupName', false); + var webAppName: string = tl.getInput('appName', true); + var resourceGroupName: string = tl.getInput('resourceGroupName', false); var slotName: string = tl.getInput('slotName', false); var AppSettings: string = tl.getInput('appSettings', false); var ConfigurationSettings: string = tl.getInput('generalSettings', false); var ConnectionStrings: string = tl.getInput('connectionStrings', false); + if(!AppSettings || !ConfigurationSettings || !ConnectionStrings) { + throw Error(tl.loc("AppServiceSettingsNotEnabled")); + } + var azureEndpoint: AzureEndpoint = await new AzureRMEndpoint(connectedServiceName).getEndpoint(); console.log(tl.loc('GotconnectiondetailsforazureRMWebApp0', webAppName)); if (!resourceGroupName) { diff --git a/Tasks/AzureAppServiceSettingsV1/task.json b/Tasks/AzureAppServiceSettingsV1/task.json index b8c7c503b452..add35c903c13 100644 --- a/Tasks/AzureAppServiceSettingsV1/task.json +++ b/Tasks/AzureAppServiceSettingsV1/task.json @@ -4,7 +4,7 @@ "friendlyName": "Azure App Service Settings", "description": "Update/Add App settings an Azure Web App for Linux or Windows", "helpUrl": "https://docs.microsoft.com/azure/devops/pipelines/tasks", - "helpMarkDown": "[Learn more about this task](https://aka.ms/azurewebappdeployreadme)", + "helpMarkDown": "[Learn more about this task](https://aka.ms/AA5wsgy)", "category": "Deploy", "visibility": [ "Build", @@ -20,6 +20,7 @@ "Minor": 0, "Patch": 0 }, + "preview": "true", "minimumAgentVersion": "2.104.1", "groups": [ { @@ -41,7 +42,7 @@ "helpMarkDown": "Select the Azure Resource Manager subscription" }, { - "name": "WebAppName", + "name": "appName", "type": "pickList", "label": "App Service name", "defaultValue": "", @@ -52,7 +53,7 @@ "helpMarkDown": "Enter or Select the name of an existing Azure App Service" }, { - "name": "ResourceGroupName", + "name": "resourceGroupName", "type": "pickList", "label": "Resource group", "defaultValue": "", @@ -118,16 +119,16 @@ ], "dataSourceBindings": [ { - "target": "WebAppName", + "target": "appName", "endpointId": "$(ConnectedServiceName)", "dataSourceName": "AzureRMWebAppNames" }, { - "target": "ResourceGroupName", + "target": "resourceGroupName", "endpointId": "$(ConnectedServiceName)", "dataSourceName": "AzureRMWebAppResourceGroup", "parameters": { - "WebAppName": "$(WebAppName)" + "WebAppName": "$(appName)" } }, { @@ -135,13 +136,13 @@ "endpointId": "$(ConnectedServiceName)", "dataSourceName": "AzureRMWebAppSlotsId", "parameters": { - "WebAppName": "$(WebAppName)", - "ResourceGroupName": "$(ResourceGroupName)" + "WebAppName": "$(appName)", + "ResourceGroupName": "$(resourceGroupName)" }, "resultTemplate": "{\"Value\":\"{{{ #extractResource slots}}}\",\"DisplayValue\":\"{{{ #extractResource slots}}}\"}" } ], - "instanceNameFormat": "Azure App Service Settings: $(WebAppName)", + "instanceNameFormat": "Azure App Service Settings: $(appName)", "execution": { "Node": { "target": "azurewebappsettings.js" @@ -169,6 +170,7 @@ "FailedToUpdateAppServiceConfiguration": "Failed to update App service '%s' configuration. Error: %s", "FailedToGetAppServiceConfiguration": "Failed to get App service '%s' configuration. Error: %s", "FailedToGetAppServicePublishingCredentials": "Failed to fetch App Service '%s' publishing credentials. Error: %s", - "FailedToGetAppServiceApplicationSettings": "Failed to get App service '%s' application settings. Error: %s" + "FailedToGetAppServiceApplicationSettings": "Failed to get App service '%s' application settings. Error: %s", + "AppServiceSettingsNotEnabled" : "App Service Settings is not enabled. Please provide one of the following : App Settings or General Settings or Connection Strings." } } \ No newline at end of file diff --git a/Tasks/AzureAppServiceSettingsV1/task.loc.json b/Tasks/AzureAppServiceSettingsV1/task.loc.json index bb7aa2c1beed..abc7a3497a25 100644 --- a/Tasks/AzureAppServiceSettingsV1/task.loc.json +++ b/Tasks/AzureAppServiceSettingsV1/task.loc.json @@ -20,6 +20,7 @@ "Minor": 0, "Patch": 0 }, + "preview": "true", "minimumAgentVersion": "2.104.1", "groups": [ { @@ -41,26 +42,26 @@ "helpMarkDown": "ms-resource:loc.input.help.ConnectedServiceName" }, { - "name": "WebAppName", + "name": "appName", "type": "pickList", - "label": "ms-resource:loc.input.label.WebAppName", + "label": "ms-resource:loc.input.label.appName", "defaultValue": "", "required": true, "properties": { "EditableOptions": "True" }, - "helpMarkDown": "ms-resource:loc.input.help.WebAppName" + "helpMarkDown": "ms-resource:loc.input.help.appName" }, { - "name": "ResourceGroupName", + "name": "resourceGroupName", "type": "pickList", - "label": "ms-resource:loc.input.label.ResourceGroupName", + "label": "ms-resource:loc.input.label.resourceGroupName", "defaultValue": "", "required": true, "properties": { "EditableOptions": "True" }, - "helpMarkDown": "ms-resource:loc.input.help.ResourceGroupName" + "helpMarkDown": "ms-resource:loc.input.help.resourceGroupName" }, { "name": "slotName", @@ -118,16 +119,16 @@ ], "dataSourceBindings": [ { - "target": "WebAppName", + "target": "appName", "endpointId": "$(ConnectedServiceName)", "dataSourceName": "AzureRMWebAppNames" }, { - "target": "ResourceGroupName", + "target": "resourceGroupName", "endpointId": "$(ConnectedServiceName)", "dataSourceName": "AzureRMWebAppResourceGroup", "parameters": { - "WebAppName": "$(WebAppName)" + "WebAppName": "$(appName)" } }, { @@ -135,8 +136,8 @@ "endpointId": "$(ConnectedServiceName)", "dataSourceName": "AzureRMWebAppSlotsId", "parameters": { - "WebAppName": "$(WebAppName)", - "ResourceGroupName": "$(ResourceGroupName)" + "WebAppName": "$(appName)", + "ResourceGroupName": "$(resourceGroupName)" }, "resultTemplate": "{\"Value\":\"{{{ #extractResource slots}}}\",\"DisplayValue\":\"{{{ #extractResource slots}}}\"}" } @@ -169,6 +170,7 @@ "FailedToUpdateAppServiceConfiguration": "ms-resource:loc.messages.FailedToUpdateAppServiceConfiguration", "FailedToGetAppServiceConfiguration": "ms-resource:loc.messages.FailedToGetAppServiceConfiguration", "FailedToGetAppServicePublishingCredentials": "ms-resource:loc.messages.FailedToGetAppServicePublishingCredentials", - "FailedToGetAppServiceApplicationSettings": "ms-resource:loc.messages.FailedToGetAppServiceApplicationSettings" + "FailedToGetAppServiceApplicationSettings": "ms-resource:loc.messages.FailedToGetAppServiceApplicationSettings", + "AppServiceSettingsNotEnabled": "ms-resource:loc.messages.AppServiceSettingsNotEnabled" } } \ No newline at end of file