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

Getting --impersonate working correctly, for logged_in_user in configuration #190

Closed
wants to merge 5 commits into from
Closed

Conversation

pmatthews05
Copy link

When first deploy LandingZones with level0 it is deployed with a user account. During the deployment of Level0 the following Service Principal is created - [prefix]-caf_launchpad_level0.

rover -lz /tf/caf/landingzones/caf_launchpad \
  -var-folder /tf/caf/configuration/${ENVIRONMENT}/level0/launchpad \
  -parallelism 30 \
  -level level0 \
  -launchpad \
  -env ${ENVIRONMENT} \
  -a apply

The clientID, Secret is stored within Level0 keyvault [prefix]-kv-level0 as the following 3 values:
aadapp-caf-launchpad-level0-client-id
aadapp-caf-launchpad-level0-client-secret
aadapp-caf-launchpad-level0-tenant-id

launchpad-secret-prefix <- Currently missing from the scenerio 200.

With those 4 values above in the keyvault, it then allows the user to use the service principal going forward instead of a user account.

rover -lz /tf/caf/landingzones/caf_launchpad \
  -var-folder /tf/caf/configuration/${ENVIRONMENT}/level0/launchpad \
  -parallelism 30 \
  -level level0 \
  -env ${ENVIRONMENT} \
  -a apply \
 --impersonate

The code get's the ClientID and Secret, logs in as the service principal and apply terraform as that service principal.

The changes made in this pull request:

@pmatthews05
Copy link
Author

I see this has failed checks. Could someone advise what I need to do?

@LaurentLesle
Copy link
Contributor

@pmatthews05 This is related to the security credentials the CI is using to test your PR (https://github.community/t/allow-secrets-to-be-shared-with-forks-from-trusted-actions/16525). I will merge it to an integration branch to fix this issue.

@arnaudlh
Copy link
Member

arnaudlh commented Dec 3, 2021

Hi @pmatthews05 as discussed in in #218, we are replacing with --impersonate-from-keyvault in order to simplify operations.

@arnaudlh arnaudlh closed this Dec 3, 2021
@pmatthews05
Copy link
Author

@arnaudlh thank you. Is there documentation on how to setup and use the --impersonate-from-keyvault?

@brk3
Copy link
Contributor

brk3 commented Dec 4, 2021

@pmatthews05 I can document this if I remember :) In general its basically:

  • Create a keyvault and service principal
  • Add the sp-client-id, sp-client-secret and sp-tenant-id to the vault
  • Then run:
rover --impersonate-sp-from-keyvault-url https://myvault.vault.azure.net

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