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

Create webapp from arm template automatically #285

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

epa095
Copy link

@epa095 epa095 commented Jun 1, 2020

This PR adds the ability to create the azure web app automatically from an ARM template (#275), so one does not have to do those manual steps. There are two points worth mentioning:

  1. It seems like the azure web app must have an actual docker image available when it is created (with docker support), so instead of deploying the web app in the environment-setup pipeline, we have to set it up in the normal pipeline, after the docker image is pushed to the ACR. This should not be much of a problem, but there can be problems if you have policies in your tenant which automatically sets some properties (i.e. ftps only).

  2. EDIT: This has now been changed to use AZ CLI instead. To get the password from the ACI I had to resort to quite an ugly hack. I tried to have the following in webapp-env.json , but it just did not work (authentication error).

                 "name": "DOCKER_REGISTRY_SERVER_PASSWORD",
                "value": "[listCredentials(resourceId('Microsoft.ContainerRegistry/registries',parameters('acr')),'2019-05-01').username]"

If instead I entered the password directly it worked. And if I put that exact line in the "outputs" section in printed the password fine. It might have something to do with evaluation order of the function listCredentials, IDK. So instead I had to create another ARM script which got the credentials, passed them as an output and then this output got used by the main ARM template as a parameter. 🤦

This closes #275

@msftclas
Copy link

msftclas commented Jun 1, 2020

CLA assistant check
All CLA requirements met.

.pipelines/diabetes_regression-ci.yml Outdated Show resolved Hide resolved
environment_setup/arm-templates/aci-password.json Outdated Show resolved Hide resolved
Copy link
Contributor

@j-so j-so left a comment

Choose a reason for hiding this comment

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

Requesting change to use the CLI instead of ARM template to get credentials - thanks!

@epa095 epa095 requested a review from j-so July 8, 2020 08:21
@epa095
Copy link
Author

epa095 commented Jul 8, 2020

I rebased, ported to the new CI/CD setup, and use AZ cli instead of ARM to get username/password.
Unfortunately, with the new CI/CD this project has now deviated a bit from our internal version (which is based on this repository from a few months ago), so that part of it has not been tested.

@@ -40,3 +40,6 @@ steps:
# Set environment variable using the last line of logs that has the package location
IMAGE_LOCATION=$(tail -n 1 image_logs.txt)
echo "##vso[task.setvariable variable=IMAGE_LOCATION]$IMAGE_LOCATION"
echo $IMAGE_LOCATION > image_location.txt
IMAGE_TAGGED="$(sed 's/@sha256.*/:latest/g' image_location.txt)"
echo "##vso[task.setvariable variable=IMAGE_TAGGED]$IMAGE_TAGGED"
Copy link
Contributor

@j-so j-so Sep 11, 2020

Choose a reason for hiding this comment

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

Why the need for this additional environment variable? Can we reuse the image location variable?

@lokijota
Copy link
Contributor

Have added additional instructions to the WebApp deployment part to detail required steps, until this is checked/automated. As mentioned, the image has to be created before the webapp can be created.

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.

Feature: environment setup for azure App Service
4 participants