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

Stop using publishing profile to get applicationURL #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
33 changes: 0 additions & 33 deletions packages/appservice-rest/src/Arm/azure-app-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export class AzureAppService {
private _slotUrl: string;
public _client: ServiceClient;
private _appServiceConfigurationDetails: AzureAppServiceConfigurationDetails;
private _appServicePublishingProfile: any;
private _appServiceApplicationSetings: AzureAppServiceConfigurationDetails;
private _appServiceConfigurationSettings: AzureAppServiceConfigurationDetails;
private _appServiceConnectionString: AzureAppServiceConfigurationDetails;
Expand Down Expand Up @@ -83,14 +82,6 @@ export class AzureAppService {
}
}

public async getPublishingProfileWithSecrets(force?: boolean): Promise<any>{
if(force || !this._appServicePublishingProfile) {
this._appServicePublishingProfile = await this._getPublishingProfileWithSecrets();
}

return this._appServicePublishingProfile;
}

public async getPublishingCredentials(): Promise<any> {
try {
var httpRequest: WebRequest = {
Expand Down Expand Up @@ -477,30 +468,6 @@ export class AzureAppService {
return this._slot ? this._slot : "production";
}

private async _getPublishingProfileWithSecrets(): Promise<any> {
try {
var httpRequest: WebRequest = {
method: 'POST',
uri: this._client.getRequestUri(`//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/${this._slotUrl}/publishxml`,
{
'{resourceGroupName}': this._resourceGroup,
'{name}': this._name,
}, null, '2016-08-01')
}

var response = await this._client.beginRequest(httpRequest);
if(response.statusCode != 200) {
throw ToError(response);
}

var publishingProfile = response.body;
return publishingProfile;
}
catch(error) {
throw Error("Failed to fetch publishing profile for app service " + this._getFormattedName() + ".\n" + getFormattedError(error));
}
}

private async _getApplicationSettings(): Promise<AzureAppServiceConfigurationDetails> {
try {
var httpRequest: WebRequest = {
Expand Down
27 changes: 3 additions & 24 deletions packages/appservice-rest/src/Utilities/AzureAppServiceUtility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,10 @@ export class AzureAppServiceUtility {
this._webClient = new WebClient();
}

public async getWebDeployPublishingProfile(): Promise<any> {
var publishingProfile = await this._appService.getPublishingProfileWithSecrets();
var defer = Q.defer<any>();
parseString(publishingProfile, (error, result) => {
if(!!error) {
defer.reject(error);
}
var publishProfile = result && result.publishData && result.publishData.publishProfile ? result.publishData.publishProfile : null;
if(publishProfile) {
for (var index in publishProfile) {
if (publishProfile[index].$ && publishProfile[index].$.publishMethod === "MSDeploy") {
defer.resolve(result.publishData.publishProfile[index].$);
}
}
}

defer.reject('Error : No such deploying method exists.');
});

return defer.promise;
}

public async getApplicationURL(virtualApplication?: string): Promise<string> {
let webDeployProfile: any = await this.getWebDeployPublishingProfile();
return await webDeployProfile.destinationAppUrl + ( virtualApplication ? "/" + virtualApplication : "" );
var app = await this._appService.get()
var applicationUri = (app.properties["hostNameSslStates"] || []).find(n => n.hostType == "Standard");
return `https://${applicationUri["name"]}` + ( virtualApplication ? "/" + virtualApplication : "" );
}

public async pingApplication(): Promise<void> {
Expand Down