I want to use an Azure DevOps YAML pipeline to deploy to an AWS stack with EC2 instances and a Load Balancer. I've read here that I can use the AWS userdata script to join new EC2 instances to the Azure DevOps Environment.
My question is, how can I get my Azure DevOps Environment or YAML build to deploy to new servers that join that group? For example, if I use auto-scaling and a new server spins up.
I know that Deployment Groups which are used in the Classic Pipelines had a feature that allowed you to enable a Post Deployment Trigger that could redeploy the last successful build when a new server joined like this.
Is this possible to do with YAML Environments? If so, how?
If it matters, I hope to be able to share the AWS stack and have several separate applications that will get deployed to the same stack with their own YAML builds.
Related
I am using azure devops to run my pipeline using yml file and i use self hosted agent to run my pipeline on it.
I need to use the azure environment to connect my private cluster to monitor pods and my app.
can i achieve that ?
if yes how to do that?
I made a Terraform to create an infrastructure on Azure.
I used the provider "microsoft/azuredevops".
I need to add VMs and Azure Kubernetes Service on a specific environment that I created.
My question is how to deploy the script (which put tags) to them ?
It's not possible to deploy it in an Azure DevOps Pipeline because this last doesn't know VMs (and AKS).
I don't see anything else to made it with the provider azuredevops.
The solution (I think) will would be to extract the original script from an environment on Pipeline/Environment. I need to change all variables as personal access token and others too.
But I don't know if Microsoft change the script regularly.
What's the best solution ?
Thank you.
If you want to manage Azure resources with Terraform then you need to use the AzureRM provider not the Azure DevOps provider. The Azure DevOps provider is for managing your Azure DevOps instance.
The AzureRM provider contains resources for managing Linux and Windows VM's or for other types of resource such as AKS
Once you've written your terraform code, you can use a pipeline to run the terraform against Azure. Microsoft provide a terraform extension which can be used to call terraform in your pipeline
For the pipeline to be able to authenticate against Azure you'll need to set up a service connection. This will allow the pipeline to use a service principle in azure which can be given the appropriate level of permissions to create, update, destroy Azure Resources
Hashicorp have a good tutorial on getting started with Terraform and Azure and Microsoft also have some good documentation
Microsoft also have a tutorial on using Terraform from a pipeline, it uses the classic GUI based pipelines rather than YAML but the tasks and principles will be the same for both
We have two tenants for nonprod and prod resources, along with two separate directories. The devops project connects to the nonprod directory. We have container workload in app service. And uses build and release pipeline for ci cd. Question, how to release to the production tenant?
If you go to Project Settings -> Service Connections, and add a new service connection, choose Azure Resource Manager as the type, and then Azure Resource Manager using service principal (manual), you should be able to specify everything you need to connect to the tenant and subscription to which you wish to deploy:
To deploy services via Azure Devops to my kubernetes cluster, I need to create a Kubernetes Service Connection manually. I want to automate this by creating the service connection dynamically in Azure DevOps so I can delete and recreate the cluster and deployment. Is this possible? How can I do this?
you can create the service endpoint using the azure devops api,
check this out for api detail
this might be related
I'm trying to write some Cloudformation templates to setup a new account with all the resources needed for running our site. In this case we'll be setting up a UAT/test environment.
I have setup:
VPC
Security groups
ElastiCache
ALB
RDS
Auto scaling group
What I'm struggling with is, when I bring up my auto scaling group with our silver AMI, it fails health checks and the auto scaling group gets rolled back.
I have our code in a git repo, which is to be deployed via CodeDeploy, but it seems I can't add a CodeDeploy deployment without an auto scaling group and I can't setup the auto scaling group without CodeDeploy.
Should I modify our silver AMI to fake the health checks so the auto scaling group can be created? Or should I create the auto scaling group without health checks until a later step?
How can I programmatically setup CodeDeploy with Cloudformation so it pulls the latest code from our git repo?
Create the deployment app, group, etc. when you create the rest of the infrastructure, via CloudFormation.
One of the parameters to your template would be the app package already found in an S3 code deploy bucket, or the Github commit id to a working release of your app.
In addition to the other methods available to you in CodeDeploy, you can use AWS CloudFormation templates to perform the following tasks: Create applications, Create deployment groups and specify a target revision, Create deployment configurations, Create Amazon EC2 instances.
See https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-cloudformation-templates.html
With this approach you can launch a working version of your app as you create your infrastructure. Use normal health checks so you can be sure your app is properly configured.