Can I use ADO to provision resources in GCP?

Cam Hashi 40 Reputation points
2023-11-25T19:25:04.3066667+00:00

We have a GCP environment and we started using Azure DevOps a while ago to provision infrastructure using IaC.

I was wondering if we could use Azure DevOps to create infrastructure in GCP ? If yes, how ?

Thank you in advance

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,088 questions
0 comments No comments
{count} votes

Accepted answer
  1. Adam Zachary 2,911 Reputation points
    2023-11-25T19:32:39.96+00:00

    Hi Cam,

    Yes, you can use Azure DevOps to provision Google Cloud Platform (GCP) resources.

    Here is a step-by-step guide based on a practical example of deploying a Google Cloud function to GCP using Azure DevOps:

    Setting up a Google Service Account

    1. Log in to the GCP Console.
    2. Select your project.
    3. Activate Cloud Shell.
    4. Set default configuration values:
    • gcloud config set project [PROJECT_ID]
    • gcloud config set compute/zone [ZONE]
    1. Create a Service Account:
    • gcloud iam service-accounts create azure-pipelines-publisher --display-name "Azure Pipelines Publisher"
    1. Assign the Storage Admin IAM role to the service account:
    • Execute a series of commands to set the project number, get the service account email, and assign the role​​.

    Storing Service Account Key in Azure DevOps

    1. Navigate to IAM & Admin / Service Accounts in GCP and edit the service account you created.
    2. Create a key and download it.
    3. In Azure DevOps, go to the Library under Pipelines and select "Secure Files".
    4. Upload the key and authorize it for all pipelines​​.

    Creating CI/CD Pipeline in Azure DevOps

    1. Use the secure key by adding the DownloadSecureFile@1 task in your pipeline YAML.
    2. Install Google Cloud SDK on the Azure pipeline agent if it's not pre-installed. This can be done by downloading and installing the SDK via script commands.
    3. Deploy the function using a script:
    • Authenticate using the service account key.
    • Deploy the function with a command like **gcloud functions deploy [FUNCTION_NAME] --runtime nodejs8 --trigger-http --region=[REGION] --project=[PROJECT_ID]**​​.

    Hope this helps!


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.