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

msi for native support #6655

Merged
merged 14 commits into from
Apr 15, 2018
Merged

Conversation

RoshanKumarMicrosoft
Copy link
Contributor

No description provided.

@RoshanKumarMicrosoft
Copy link
Contributor Author

RoshanKumarMicrosoft commented Mar 27, 2018

We can't go with Add-AzureRmAccount -MSI approach this feature is only available from 5.5.0. But in our case if vm is MSI enabled then it has backward compatibility as well. So going with token approach.

@@ -30,7 +30,7 @@ function Update-PSModulePathForHostedAgent {
$hostedAgentAzureModulePath = Get-LatestModule -patternToMatch "^azure_[0-9]+\.[0-9]+\.[0-9]+$" -patternToExtract "[0-9]+\.[0-9]+\.[0-9]+$" -Classic:$true
}

if($authScheme -eq 'ServicePrincipal' -or $authScheme -eq '')
if($authScheme -eq 'ServicePrincipal' -or $authScheme -eq '' -or $authScheme -eq 'ManagedServiceIdentity')
Copy link
Member

Choose a reason for hiding this comment

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

Would be good to move the empty check to the end.

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.

$port = $Endpoint.Data.MsiPort
}
$msiUri = "http://localhost:$port/oauth2/token"
$response = Invoke-WebRequest -Uri $msiUri -Method GET -Body @{resource= $Endpoint.Url} -Headers @{Metadata="true"} -UseBasicParsing
Copy link
Member

Choose a reason for hiding this comment

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

All these logic has to 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.

throw (New-Object System.Exception((Get-VstsLocString -Key AZ_ManagedServiceIdentityError), $_.Exception))
}

Set-CurrentAzureRMSubscription -SubscriptionId $Endpoint.Data.SubscriptionId -TenantId $Endpoint.Auth.Parameters.TenantId
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 merge with latest changes for TLS done by Rajat.

}
catch
{
$exceptionMessage = $_.Exception.Message.ToString()
Copy link
Member

Choose a reason for hiding this comment

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

@Ajay-MS - Can you ensure post Roshan's change, your changes to log the error code is factored in.

Copy link

Choose a reason for hiding this comment

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

Sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will take into separate PR.

@RoshanKumarMicrosoft RoshanKumarMicrosoft merged commit 4f134b9 into master Apr 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants