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

Does New-APSession support a managed identity to connect to Azure DevOps? #31

Open
BertusV opened this issue Apr 27, 2023 · 4 comments
Open

Comments

@BertusV
Copy link

BertusV commented Apr 27, 2023

Now that DevOps support managed identities I would like to use that to automate some tasks rather than using a PAT.

Previously I used this code to connect from an Azure PowerShell function app:

$splat = @{
Collection = 'xxxxxxxxxxxxx'
Project = 'Management%20Infrastructure'
Instance = 'https://dev.azure.com/'
ApiVersion = '7.1-preview'
SessionName = 'mySession'
PersonalAccessToken = $env:PAT
}
$session = New-APSession @Splat

I hoped the script would work like this but I'm getting Authentication issues. In a separate funtion I can use the same identity to authN to Azure resources.

$splat = @{
Collection = 'xxxxxxxxxxxx'
Project = 'Management%20Infrastructure'
Instance = 'https://dev.azure.com/'
ApiVersion = '7.1-preview'
SessionName = 'mySession'
}
$session = New-APSession @Splat

I hope you can point me in the right direction.

Regards,
BertusV

@Dejulia489
Copy link
Owner

Are you running this in a pipeline?

@BertusV
Copy link
Author

BertusV commented Apr 27, 2023

No, I'm running this in a Azure Function App (PowerShell). The function app has a managed identity assigned to it. That same identity is configured in Azure DevOps.

@Dejulia489
Copy link
Owner

@BertusV
Copy link
Author

BertusV commented Apr 28, 2023

I'll give it a try and get back to you.

Thanks.

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

No branches or pull requests

2 participants