Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterize app insights web test name in Azure App Service Manage Task #7477

Merged
merged 4 commits into from
Jul 20, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"loc.input.help.AppInsightsResourceGroupName": "Enter or Select resource group where your application insights resource is available",
"loc.input.label.ApplicationInsightsResourceName": "Application Insights resource name",
"loc.input.help.ApplicationInsightsResourceName": "Select Application Insights resource where continuous monitoring data will be recorded. <br/>If your application insights resource is not listed here and you want to create a new resource, click on [+New] button. Once the resource is created on Azure Portal, come back here and click on refresh button.",
"loc.input.label.ApplicationInsightsWebTestName": "Application Insights web test name",
"loc.input.help.ApplicationInsightsWebTestName": "Enter Application Insights Web Test name to be created or updated. <br/>If not provided, the default test name will be used.",
"loc.messages.ErrorNoSuchDeployingMethodExists": "Error : Deploy method MSDeploy does not exists for Azure Web App: %s",
"loc.messages.Successfullyupdatedslotswaphistory": "Successfully updated slot swap history at %s for Azure Web App : %s",
"loc.messages.Failedtoupdateslotswaphistory": "Failed to update slot swap history for Azure Web App : %s",
Expand Down
3 changes: 2 additions & 1 deletion Tasks/AzureAppServiceManageV0/azureappservicemanage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ async function run() {
var preserveVnet: boolean = tl.getBoolInput('PreserveVnet', false);
var extensionList = tl.getInput('ExtensionsList', false);
var extensionOutputVariables = tl.getInput('OutputVariable');
var appInsightsWebTestName = tl.getInput('ApplicationInsightsWebTestName', false);
var taskResult = true;
var errorMessage: string = "";
var updateDeploymentStatus: boolean = true;
Expand Down Expand Up @@ -107,7 +108,7 @@ async function run() {
}
case "Enable Continuous Monitoring": {
var appInsights: AzureApplicationInsights = new AzureApplicationInsights(azureEndpoint, appInsightsResourceGroupName, appInsightsResourceName);
await enableContinuousMonitoring(azureEndpoint, appService, appInsights);
await enableContinuousMonitoring(azureEndpoint, appService, appInsights, appInsightsWebTestName);
break;
}
default: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { AzureApplicationInsightsWebTestsUtils } from './AzureApplicationInsight

const APPLICATION_INSIGHTS_EXTENSION_NAME: string = "Microsoft.ApplicationInsights.AzureWebSites";

export async function enableContinuousMonitoring(endpoint: AzureEndpoint, appService: AzureAppService, appInsights: AzureApplicationInsights) {
export async function enableContinuousMonitoring(endpoint: AzureEndpoint, appService: AzureAppService, appInsights: AzureApplicationInsights, testName?: string) {
try {
console.log(tl.loc('EnablingContinousMonitoring', appService.getName()));
var appDetails = await appService.get();
Expand Down Expand Up @@ -42,7 +42,7 @@ export async function enableContinuousMonitoring(endpoint: AzureEndpoint, appSer
try {
tl.debug('add web test for app service - app insights');
var appInsightsWebTestsUtils: AzureApplicationInsightsWebTestsUtils = new AzureApplicationInsightsWebTestsUtils(appInsightsWebTests);
await appInsightsWebTestsUtils.addWebTest(appInsightsResource, applicationUrl);
await appInsightsWebTestsUtils.addWebTest(appInsightsResource,applicationUrl, testName);
}
catch(error) {
tl.warning(error);
Expand Down
11 changes: 10 additions & 1 deletion Tasks/AzureAppServiceManageV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 0,
"Minor": 2,
"Patch": 32
"Patch": 33
},
"minimumAgentVersion": "1.102.0",
"instanceNameFormat": "$(Action): $(WebAppName)",
Expand Down Expand Up @@ -187,6 +187,15 @@
},
"visibleRule": "Action == Enable Continuous Monitoring",
"helpMarkDown": "Select Application Insights resource where continuous monitoring data will be recorded. <br/>If your application insights resource is not listed here and you want to create a new resource, click on [+New] button. Once the resource is created on Azure Portal, come back here and click on refresh button."
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this input under 'Advanced settings'

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hkamel can you give me collaborator permission so that I can update the required changes to your PR.

"name": "ApplicationInsightsWebTestName",
"type": "string",
"label": "Application Insights web test name",
"defaultValue": "",
"required": false,
"visibleRule": "Action == Enable Continuous Monitoring",
"helpMarkDown": "Enter Application Insights Web Test name to be created or updated. <br/>If not provided, the default test name will be used."
}
],
"outputVariables": [
Expand Down
11 changes: 10 additions & 1 deletion Tasks/AzureAppServiceManageV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 0,
"Minor": 2,
"Patch": 32
"Patch": 33
},
"minimumAgentVersion": "1.102.0",
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down Expand Up @@ -191,6 +191,15 @@
},
"visibleRule": "Action == Enable Continuous Monitoring",
"helpMarkDown": "ms-resource:loc.input.help.ApplicationInsightsResourceName"
},
{
"name": "ApplicationInsightsWebTestName",
"type": "string",
"label": "ms-resource:loc.input.label.ApplicationInsightsWebTestName",
"defaultValue": "",
"required": false,
"visibleRule": "Action == Enable Continuous Monitoring",
"helpMarkDown": "ms-resource:loc.input.help.ApplicationInsightsWebTestName"
}
],
"outputVariables": [
Expand Down