microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.49k stars 2.61k forks source link

Build Immutable Image: Not possible to use Azure Service Subscribtion when using 'user provided' Packer template #7668

Closed riezebosch closed 5 years ago

riezebosch commented 6 years ago

It is currently not possible to use a service endpoint when specifying a custom template. That's sad because I have my own template in the repo but still want to run and deploy it on Azure.

RoopeshNair commented 6 years ago

@riezebosch - can you please elaborate, "service endpoint when specifying a custom template"? are you referring to a task or template?

riezebosch commented 6 years ago

I want to use the 'packer build' task to build an image using my own packer template. But I also want to use the Packer Azure Builder. But instead of providing the credentials on the arguments (service principal and client secret) I want to use a Service Endpoint. That combination is currently not possible.

(see also: https://github.com/MicrosoftDocs/vsts-docs/issues/1258#issuecomment-403878078)

RoopeshNair commented 6 years ago

@azooinmyluggage - ask for endpoint support in Packer Build Image task with user-provided template option,

riezebosch commented 6 years ago

Created the tasks myself: https://marketplace.visualstudio.com/items?itemName=riezebosch.Packer

bishal-pdMSFT commented 6 years ago

I would let @azooinmyluggage comment on this. However, one complexity I can see is how does task map service endpoint details to custom template's variables? Task does not know which variables are defined in custom template.

azooinmyluggage commented 6 years ago

Hi @riezebosch This has been in our backlog for sometime and there is a scenario where it can be used in one of internal requirements. Is there any possibility of you contributing to our task? Having a single task will help everyone. I can work with you on that.

riezebosch commented 6 years ago

@bishal-pdMSFT For the time being I simply use client_id, client_secret, subscription_id and tenant_id for that because that maps to the field names that are used by the azure-arm provider. If people want to deviate we can introduce input parameters for custom variable names but I dislike the added complexity compared to the added value of that. Another possible solution would be updating the json and simply setting the value of the fields in the directly.

@azooinmyluggage I would love to but I have my concerns about the current vision of the task. Your task tries to abstract the packer details away from the novice whereas my tasks are a mere wrapper around the basic functionality while providing Azure integration. I'm not sure if these two can be combined in a nice way. Maybe you can check if the internal requirements are met with the current implementation of my tasks?