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

Users/ajya/nationalcloudclientsidechanges #3551

Merged
merged 13 commits into from
Feb 16, 2017

Conversation

Ajay-MS
Copy link

@Ajay-MS Ajay-MS commented Feb 7, 2017

No description provided.

@desattir
Copy link

desattir commented Feb 7, 2017

LGTM 👍

Copy link
Member

@sachinma sachinma left a comment

Choose a reason for hiding this comment

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

I have looked at the changes for AzureRG only

private token_deferred: Q.Promise<string>;

constructor(clientId: string, domain: string, secret: string) {
constructor(clientId: string, domain: string, secret: string, armUrl: string, authUrl: string) {
Copy link
Member

Choose a reason for hiding this comment

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

authUrl is confusing since auth is mostly used for authentication. I would prefer full name authorityUrl


var deferred = Q.defer<string>();
var authorityUrl = authUrl + SPN.tenantID + "/oauth2/token/";
var envAuthUrl = endpoint.envAuthUrl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Check if it is necessary to hard-code envAuthUrl if it is null.

@Ajay-MS Ajay-MS requested a review from chshrikh February 8, 2017 06:27
Copy link
Contributor

@vincent1173 vincent1173 left a comment

Choose a reason for hiding this comment

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

Looks Good.
✅ Azure App Service Manage Task
✅ Azure App Service Deploy Task

@@ -41,6 +41,11 @@ function Initialize-AzureSubscription {

#Set UserAgent for Azure Calls
Set-UserAgent

$environmentName = "AzureCloud"
if( $Endpoint.Data.Environment ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this does not validate if it contains an empty string with space. Please check if you want to trim it before it gets used

@@ -127,7 +127,7 @@ function Initialize-AzureSubscription {
# Else, this is AzureRM.
try {
Write-Host "##[command]Add-AzureRMAccount -ServicePrincipal -Tenant $($Endpoint.Auth.Parameters.TenantId) -Credential $psCredential"
$null = Add-AzureRMAccount -ServicePrincipal -Tenant $Endpoint.Auth.Parameters.TenantId -Credential $psCredential
$null = Add-AzureRMAccount -ServicePrincipal -Tenant $Endpoint.Auth.Parameters.TenantId -Credential $psCredential -EnvironmentName $environmentName
Copy link
Contributor

Choose a reason for hiding this comment

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

better to log $environmentName if it is within security rules

@@ -321,6 +321,8 @@
"ClientIdCannotBeEmpty": "clientId must be a non empty string.",
"DomainCannotBeEmpty": "domain must be a non empty string.",
"SecretCannotBeEmpty": "secret must be a non empty string.",
"armUrlCannotBeEmpty": "arm Url must be a non empty string.",
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 plan only to add support in latest task version for ARG? I am fine with that call, but want to confirm with PMs.

@@ -1,8 +1,8 @@
# Private module-scope variables.
$script:jsonContentType = "application/json;charset=utf-8"
$script:formContentType = "application/x-www-form-urlencoded;charset=utf-8"
$script:azureRmUri = "https://management.azure.com"
$script:authUri = "https://login.microsoftonline.com/"
$script:defaultAuthUri = "https://login.microsoftonline.com/"
Copy link
Member

Choose a reason for hiding this comment

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

I can't find this URL in the get-Environment output. What url does this map to?

Copy link
Author

Choose a reason for hiding this comment

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

login.windows.net is legacy auth URL, login.microsoftonline.com is latest auth url. In environment property its showing only latest one. Since other URL is being used at many places in application so added it as another property.

$authUrl = $script:defaultAuthUri
if($endpoint.Data.activeDirectoryAuthority)
{
$authUrl = $endpoint.Data.activeDirectoryAuthority
Copy link
Member

Choose a reason for hiding this comment

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

Is activeDirecotryAuthority and environment Auth Url used interchangeably?

Copy link
Member

Choose a reason for hiding this comment

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

In the GetAccessToken in nlbUtility you were using the environment Auth url. Why?

@@ -41,6 +41,11 @@ function Initialize-AzureSubscription {

#Set UserAgent for Azure Calls
Set-UserAgent

Copy link
Member

Choose a reason for hiding this comment

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

Can you ensure Azure PowerShell task is covered as part of your testing?

Copy link
Author

Choose a reason for hiding this comment

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

Yes I have tested Azure Powershell Task

@@ -5,19 +5,20 @@ import * as httpClient from 'vso-node-api/HttpClient';
import * as restClient from 'vso-node-api/RestClient';

var httpObj = new httpClient.HttpCallbackClient(tl.getVariable("AZURE_HTTP_USER_AGENT"));
var authUrl = 'https://login.windows.net/';
var defaultAuthUrl = 'https://login.windows.net/';
var azureApiVersion = '2016-09-01';
Copy link
Member

Choose a reason for hiding this comment

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

Did this API version work fine in other Cloud environment types. Do you see any issue with Azure deployments causing issues?

var azureApiVersion = '2016-09-01';

function getAccessToken(SPN, endpointUrl: string): Q.Promise<string> {
function getAccessToken(endpoint, endpointUrl: string): Q.Promise<string> {
Copy link
Member

Choose a reason for hiding this comment

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

having the second parameter as enpointurl is confusing. There is already endpoint taken as input which has endpoint.url. I presume this is the resource for which you are requesting token. So should we just call it resource?

$authUrl = $script:defaultAuthUri
if($endpoint.Data.activeDirectoryAuthority)
{
$authUrl = $endpoint.Data.activeDirectoryAuthority
Copy link
Member

Choose a reason for hiding this comment

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

In the GetAccessToken in nlbUtility you were using the environment Auth url. Why?

@Ajay-MS Ajay-MS merged commit d539c24 into master Feb 16, 2017
Ajay-MS pushed a commit that referenced this pull request Feb 16, 2017
* Changes for national cloud

* consume arm url from endpoint

* authUrl and envAuthUrl fix

* Test correction for client side changes

* bump up task version and fixing review comments

* null check for auth url in NLB task

* added URL in endpoint object for NLB task

* added environment to logs

* reverted variable name back to SPN

* Bump up task version corrsponding to master

* corrections

* Increased patch version for AFC
Ajay-MS pushed a commit that referenced this pull request Mar 7, 2017
* Users/ajya/nationalcloudclientsidechanges (#3551)

* Changes for national cloud

* consume arm url from endpoint

* authUrl and envAuthUrl fix

* Test correction for client side changes

* bump up task version and fixing review comments

* null check for auth url in NLB task

* added URL in endpoint object for NLB task

* added environment to logs

* reverted variable name back to SPN

* Bump up task version corrsponding to master

* corrections

* Increased patch version for AFC

* back compat for xml sub

* resolve merge conflict

* loc.json updated

* Increase patch version as release branch version has been bumbed up

* Increased patch version due to vincent xml sub fix

* patch version bump up due to vincent fix

* default URL check for Deploy Azure RG Task

* Increased patch version of AFC to build package
@bryanmacfarlane bryanmacfarlane deleted the users/ajya/nationalcloudclientsidechanges branch January 31, 2018 00:28
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.

8 participants