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

Check msdeploy version #19170

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -223,5 +223,6 @@
"loc.messages.ASE_WebDeploySSLIssueRecommendation": "To use a certificate in App Service, the certificate must be signed by a trusted certificate authority. If your web app gives you certificate validation errors, you're probably using a self-signed certificate and to resolve them you need to pass -allowUntrusted in additional arguments of web deploy option.",
"loc.messages.FailedToUpdateApplicationInsightsResource": "Failed to update Application Insights '%s' Resource. Error: %s",
"loc.messages.JarNotSupported": "Jar deployment is not supported in this version. Change the task version to '4.*' which is in preview mode",
"loc.messages.CorrelationIdForARM": "Correlation ID from ARM api call response : %s"
"loc.messages.CorrelationIdForARM": "Correlation ID from ARM api call response : %s",
"loc.messages.MSDeployNotSupportTokenAuth": "App Service is configured to not use basic authentication. This requires Web Deploy msdeploy.exe version 7.1.7225 or higher. You need a version of Visual Studio that includes an updated version of msdeploy.exe. For more information, visit https://aka.ms/azdo-webapp-msdeploy ."
}
21 changes: 11 additions & 10 deletions Tasks/AzureRmWebAppDeploymentV3/azurermwebappdeployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { addReleaseAnnotation } from './operations/ReleaseAnnotationUtility';
import { PackageUtility } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import { isInputPkgIsFolder, canUseWebDeploy } from 'azure-pipelines-tasks-webdeployment-common/utility';
import { DeployUsingMSDeploy } from 'azure-pipelines-tasks-webdeployment-common/deployusingmsdeploy';
import { shouldUseMSDeployTokenAuth} from 'azure-pipelines-tasks-webdeployment-common/msdeployutility';
import { shouldUseMSDeployTokenAuth, installedMSDeployVersionSupportsTokenAuth} from 'azure-pipelines-tasks-webdeployment-common/msdeployutility';

async function main() {
let zipDeploymentID: string;
Expand Down Expand Up @@ -98,21 +98,22 @@ async function main() {
var msDeployPublishingProfile = await appServiceUtility.getWebDeployPublishingProfile();
let authType = "Basic";

if (await appServiceUtility.isSitePublishingCredentialsEnabled())
{
if (await appServiceUtility.isSitePublishingCredentialsEnabled()) {
tl.debug("Using Basic authentication.")
}
else if (shouldUseMSDeployTokenAuth())
{
else if (!shouldUseMSDeployTokenAuth()) {
//deployment would fail in this case
throw new Error(tl.loc("BasicAuthNotSupported"));
}
else if (await installedMSDeployVersionSupportsTokenAuth() === false) {
//deployment would fail in this case
throw new Error(tl.loc("MSDeployNotSupportTokenAuth"));
}
else {
tl.debug("Basic authentication is disabled, using token based authentication.");
authType = "Bearer";
msDeployPublishingProfile.userPWD = await appServiceUtility.getAuthToken();
msDeployPublishingProfile.userName = "user"; // arbitrary but not empty
}
else
{
//deployment would fail in this case
throw new Error(tl.loc("BasicAuthNotSupported"));
}

if (webPackage.toString().toLowerCase().endsWith('.war')) {
Expand Down
28 changes: 25 additions & 3 deletions Tasks/AzureRmWebAppDeploymentV3/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Tasks/AzureRmWebAppDeploymentV3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"azure-pipelines-task-lib": "^4.4.0",
"agent-base": "^6.0.2",
"azure-pipelines-tasks-azure-arm-rest": "3.223.3",
"azure-pipelines-tasks-webdeployment-common": "4.230.3",
"azure-pipelines-tasks-webdeployment-common": "4.230.4",
"decompress-zip": "^0.3.3",
"ltx": "2.8.0",
"moment": "^2.29.4",
Expand Down
5 changes: 3 additions & 2 deletions Tasks/AzureRmWebAppDeploymentV3/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 3,
"Minor": 230,
"Patch": 3
"Patch": 4
},
"releaseNotes": "What's new in Version 3.0: <br/>&nbsp;&nbsp;Supports File Transformations (XDT) <br/>&nbsp;&nbsp;Supports Variable Substitutions(XML, JSON) <br/>Click [here](https://aka.ms/azurermwebdeployreadme) for more information.",
"minimumAgentVersion": "2.104.1",
Expand Down Expand Up @@ -765,6 +765,7 @@
"ASE_WebDeploySSLIssueRecommendation": "To use a certificate in App Service, the certificate must be signed by a trusted certificate authority. If your web app gives you certificate validation errors, you're probably using a self-signed certificate and to resolve them you need to pass -allowUntrusted in additional arguments of web deploy option.",
"FailedToUpdateApplicationInsightsResource": "Failed to update Application Insights '%s' Resource. Error: %s",
"JarNotSupported": "Jar deployment is not supported in this version. Change the task version to '4.*' which is in preview mode",
"CorrelationIdForARM": "Correlation ID from ARM api call response : %s"
"CorrelationIdForARM": "Correlation ID from ARM api call response : %s",
"MSDeployNotSupportTokenAuth": "App Service is configured to not use basic authentication. This requires Web Deploy msdeploy.exe version 7.1.7225 or higher. You need a version of Visual Studio that includes an updated version of msdeploy.exe. For more information, visit https://aka.ms/azdo-webapp-msdeploy ."
}
}
5 changes: 3 additions & 2 deletions Tasks/AzureRmWebAppDeploymentV3/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 3,
"Minor": 230,
"Patch": 3
"Patch": 4
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"minimumAgentVersion": "2.104.1",
Expand Down Expand Up @@ -765,6 +765,7 @@
"ASE_WebDeploySSLIssueRecommendation": "ms-resource:loc.messages.ASE_WebDeploySSLIssueRecommendation",
"FailedToUpdateApplicationInsightsResource": "ms-resource:loc.messages.FailedToUpdateApplicationInsightsResource",
"JarNotSupported": "ms-resource:loc.messages.JarNotSupported",
"CorrelationIdForARM": "ms-resource:loc.messages.CorrelationIdForARM"
"CorrelationIdForARM": "ms-resource:loc.messages.CorrelationIdForARM",
"MSDeployNotSupportTokenAuth": "ms-resource:loc.messages.MSDeployNotSupportTokenAuth"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,5 +225,6 @@
"loc.messages.FailedToGetResourceID": "Failed to get resource ID for resource type '%s' and resource name '%s'. Error: %s",
"loc.messages.JarPathNotPresent": "Java jar path is not present",
"loc.messages.FailedToUpdateApplicationInsightsResource": "Failed to update Application Insights '%s' Resource. Error: %s",
"loc.messages.RunFromZipPreventsFileInUseError": "Move from Web Deploy to RunFrom Package, which helps in avoiding FILE_IN_USE error. Note that Run From Package does not support msBuild package type. Please change your package format to use this deployment method."
"loc.messages.RunFromZipPreventsFileInUseError": "Move from Web Deploy to RunFrom Package, which helps in avoiding FILE_IN_USE error. Note that Run From Package does not support msBuild package type. Please change your package format to use this deployment method.",
"loc.messages.MSDeployNotSupportTokenAuth": "App Service is configured to not use basic authentication. This requires Web Deploy msdeploy.exe version 7.1.7225 or higher. You need a version of Visual Studio that includes an updated version of msdeploy.exe. For more information, visit https://aka.ms/azdo-webapp-msdeploy ."
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@types/q": "1.0.7",
"azure-pipelines-task-lib": "4.4.0",
"azure-pipelines-tasks-azure-arm-rest": "3.223.5",
"azure-pipelines-tasks-webdeployment-common": "4.230.3",
"azure-pipelines-tasks-webdeployment-common": "4.230.4",
"moment": "^2.29.4",
"q": "1.4.1",
"uuid": "3.1.0",
Expand Down
17 changes: 10 additions & 7 deletions Tasks/AzureRmWebAppDeploymentV4/operations/WebDeployUtility.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import tl = require('azure-pipelines-task-lib/task');

import { TaskParameters } from './TaskParameters';
import { WebDeployArguments, WebDeployResult } from 'azure-pipelines-tasks-webdeployment-common/msdeployutility';
import { WebDeployArguments, WebDeployResult, shouldUseMSDeployTokenAuth, installedMSDeployVersionSupportsTokenAuth } from 'azure-pipelines-tasks-webdeployment-common/msdeployutility';
import { executeWebDeploy } from 'azure-pipelines-tasks-webdeployment-common/deployusingmsdeploy';
import { copySetParamFileIfItExists } from 'azure-pipelines-tasks-webdeployment-common/utility';

import { TaskParameters } from './TaskParameters';
import { AzureAppServiceUtility } from './AzureAppServiceUtility';
import { shouldUseMSDeployTokenAuth } from 'azure-pipelines-tasks-webdeployment-common/msdeployutility'

const DEFAULT_RETRY_COUNT = 3;

Expand Down Expand Up @@ -61,14 +61,17 @@ export class WebDeployUtility {
webDeployArguments.userName = publishProfile.userName;
webDeployArguments.password = publishProfile.userPWD;
}
else if (shouldUseMSDeployTokenAuth()) {
else if (!shouldUseMSDeployTokenAuth()) {
throw new Error(tl.loc("BasicAuthNotSupported"));
}
else if (await installedMSDeployVersionSupportsTokenAuth() === false) {
throw new Error(tl.loc("MSDeployNotSupportTokenAuth"));
}
else {
tl.debug("Basic authentication is disabled, using token based authentication.");
webDeployArguments.authType = "Bearer";
webDeployArguments.password = await this._azureAppServiceUtility.getAuthToken();
webDeployArguments.userName = "user"; // arbitrary but not empty
}
else {
throw new Error(tl.loc("BasicAuthNotSupported"));
}

webDeployArguments.publishUrl = publishProfile.publishUrl;
Expand Down
33 changes: 30 additions & 3 deletions Tasks/AzureRmWebAppDeploymentV4/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Tasks/AzureRmWebAppDeploymentV4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@types/q": "1.0.7",
"azure-pipelines-task-lib": "^3.4.0",
"azure-pipelines-tasks-azure-arm-rest": "3.223.5",
"azure-pipelines-tasks-webdeployment-common": "4.230.3",
"azure-pipelines-tasks-webdeployment-common": "4.230.4",
"moment": "^2.29.4",
"q": "1.4.1",
"uuid": "3.1.0",
Expand Down
Loading