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

azurecli classic cert auth's service url picked from endpoint #3256

Merged
merged 2 commits into from
Dec 16, 2016

Conversation

hiyadav
Copy link
Contributor

@hiyadav hiyadav commented Dec 14, 2016

Azure-CLI classic cert based authentication's Service Management URL will be picked from endpoint.

@@ -198,9 +199,9 @@ export class azureclitask {
}
}

private static createPublishSettingFile(subscriptionName:string, subscriptionId:string, certificate:string, publishSettingFileName:string): void {
private static createPublishSettingFile(subscriptionName:string, subscriptionId:string, certificate:string, serviceManagementUrl:string, publishSettingFileName:string): void {
//writing the data to the publishsetting file
Copy link
Member

Choose a reason for hiding this comment

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

Just verify if serviceManagementUrl can have a terminal slash and if so, will it cause any issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

while making a call to azure, the azurecli removes the terminal slash. Thus it is not causing any errors.
here is a screenshot of a call to azure while using a publishsetting file with serviceManagementUrl having terminal slash
image

@@ -130,8 +130,9 @@ export class azureclitask {
if (endpointAuth.scheme === "Certificate") {
var bytes = endpointAuth.parameters["certificate"];
var subscriptionId:string = tl.getEndpointDataParameter(connectedService, "SubscriptionId", true);
var serviceManagementUrl:string = tl.getEndpointUrl(connectedService, false);
const publishSettingFileName:string = path.join(os.tmpdir() ,"subscriptions" + new Date().getTime() + ".publishsettings");
Copy link
Member

Choose a reason for hiding this comment

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

Is the service endpoint URL always present - even for older endpoints which didn't allow selecting this URL? If not, see if we should fallback to the default URL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

a default service URL used to be present in older endpoints. so we should be fine.

const publishSettingFileName:string = path.join(os.tmpdir() ,"subscriptions" + new Date().getTime() + ".publishsettings");
this.createPublishSettingFile(subscriptionName, subscriptionId, bytes, publishSettingFileName);
this.createPublishSettingFile(subscriptionName, subscriptionId, bytes, serviceManagementUrl, publishSettingFileName);
var resultOfToolExecution = tl.execSync("azure", "account import \"" + publishSettingFileName + "\"");
Copy link
Member

Choose a reason for hiding this comment

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

UTs for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

Copy link
Member

@amaljg amaljg left a comment

Choose a reason for hiding this comment

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

Please make sure that you add UTs to cover the changes.

@hiyadav hiyadav merged commit 8c902da into master Dec 16, 2016
@hiyadav hiyadav deleted the users/hiyada/Azurecli branch December 16, 2016 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants