Table of Contents

Getting Started with Azure DevOps for AWS

Summary: How to setup Azure DevOps for AWS
Date: Around 2021
Refactor: 20 February 2025: Checked links and formatting.

After Getting Started With AWS, Getting Started With Office 365 and Federated Login for AWS with Azure AD and Transfer Domain to AWS I now also want use Azure DevOps in combination with AWS. The goal is to use Azure DevOps as the code repository and use a build task to upload my code to an AWS S3 bucket which is hosting the domain. This article describes the steps to do so. Used technologies:

Azure DevOps

First you need to sign up for Azure DevOps here:

Note that when you create th Azure DevOps Organization like this Azure DevOps is automatically connected to your Azure AD.

Invite Team Member from Azure AD

Because we do not want to develop the code using the administrative account you need to select a user from your AD to assign permissions in the Azure DevOps organization:

Marketplace

Azure DevOps allows for extenstions to be installed so you can modify your build and release pipelines as you desire. AWS created the AWS Tools for Azure Devops (still named after VSTS, the previous name for Azure DevOps)

Install the AWS Tools for VSTS Extension

AWS

Now we need to setup a few things in AWS. First we need to create an AWS IAM user so Azure DevOps can access the correct AWS Account and have the correct permissions to place files in the correct S3 bucket.

Create an IAM user

To use the AWS Tools for VSTS, you must have a set of valid AWS credentials, which consist of an access key and a secret key. To create one, log on with the root user (or federated equivalent ) of the AWS account you want to use and follow these steps:

Note the user it's access key ID and secret access key as you'll need it later to configure access in Azure DevOps. Also, add the username and the credentials to the lastpass root user account info for future reference or any other password management tool you keep.

Create the S3 Bucket

We will now create the S3 bucket. As you are creating a S3 bucket for a real domain here we have some specifics to consider:

We only need one bucket to upload the files to, and it needs to have the same name as the domain it will service (warmetal.nl in this case). We do need a second one however to also redirect www.warmetal.nl to this site. See here for more information.

* Open the S3 concole

Enable Static Website Hosting and Enable Public Access

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::warmetal.nl/*"
        }
    ]
}
Note that the version is a version supplied by AWS and should not be changed
Note that you now see a warning indicating that the bucket is publicly available

* Go to properties

Create the WWW S3 Bucket

Create a second bucket as described above only then with the name www.warmetal.nl

When done, follow these steps to redirect the bucket static website towards the first bucket:

Note that you do not need to change policy defaults here

Azure DevOps

It is now time to return to Azure DevOps to glue everything together. We first create the service connection so an Azure DevOps project can connect to AWS and then we create the actual build so we have something to upload the files with.

Create Service Connection

To make the AWS Connection available over all pipelines follow these steps:

Build Pipeline

Pipelines → New → New build pipeline

Click Continue Click “empty job” to create an empty pipeline

Under Agent job1 click + to add a task to the pipeline Search and add the “AWS S3 Upload” task

Now you can run the pipeline to upload the files. Afterwards you can check the full configuration by going to the s3 bucket endpoint.

Note that under some circumstances you might not be able to select an Agent Pool. I'm not sure yet if this by design or a bug, but I had to login as the administrative account and configure the build pipeline to use the “Hosted VS2017” agent pool.

Azure AD

Now we need to ass an enterprise app just so we can use the integrated login. Note that this is nothing fancy here. It just adds the enterprise app en this should work for all websites that use Azure AD integrated login.

Enterprise App

Create new Enterprise Application:

After creation, click on the Application Name under Managed Application in local directory: Azure DevOps

Now the app is available in the Microsoft MyApps Portal.

Slow

During testing I found a few times that the installation for the AWS Tools took quite some time. Even though the installation says it's done, it took hours (!) before the actual tasks became available in the buils tasks.

Resources