[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Help](/c/help/9)

# How to deploy from Azure Repo to Vercel using Vercel with custom domain for develop branch

140 views · 0 likes · 3 posts


Nidhinkumar06 (@nidhinkumar06) · 2024-07-31

I am having a Next.js project which is in Azure Repo and i want to deploy the application in Vercel. I have two branches main and develop where the main branch is used for Production and develop for dev activities. In this for main branch i have added a custom domain in vercel.

I want to add a custom domain for the preview . I have used the below script in Azure pipeline but i am not sure how to add the custom domain in this pipeline.

```
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- main
- develop

pool:
  vmImage: ubuntu-latest

jobs:
- job: deploy_main
  displayName: Deploy to Production
  condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'main'))
  steps:
  - task: vercel-deployment-task@1
    inputs:
      vercelProjectId: '***'
      vercelOrgId: '***'
      vercelToken: $(VERCEL_TOKEN)
      production: true

- job: deploy_develop
  displayName: Deploy to Preview
  condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'develop'))
  steps:
  - task: vercel-deployment-task@1
    inputs:
      vercelProjectId: '***'
      vercelOrgId: '***'
      vercelToken: $(VERCEL_TOKEN)
      production: false
```

As well as when i the pipeline runs the deployment becomes successful but the pipeline shows the following error

![Screenshot from 2024-07-31 21-21-50|690x387](upload://uxiE4yEBxVpIvBClkmNPcwPpmOT.jpeg)


Amy Egan (@amyegan) · 2024-07-31

I don't know of a way to add a custom deployment domain using `vercel-deployment-task@1`, so I'm going to ask the dev team about it. I know there are other ways to do set a custom preview domain though. 

- Vercel CLI is one option. You could use `vercel alias set [deployment-url] [custom-domain]` to [apply a custom domain to a specific deployment](https://vercel.com/docs/cli/alias). 
- A customized [Preview Deployment Suffix](https://vercel.com/docs/deployments/generated-urls#preview-deployment-suffix) is an option. Though maybe not exactly what you're looking for.
- Vercel REST API also provides a way to [assign an alias](https://vercel.com/docs/rest-api/endpoints/aliases#assign-an-alias) to a deployment.

I asked the team about the error you reported and about whether `vercel-deployment-task@1` provides a way to set a deployment alias. Will post a update here when I learn more. :slightly_smiling_face:


Amy Egan (@amyegan) · 2024-08-05

Thanks for waiting. The team confirmed that the CLI currently is your best option to add a custom domain to preview deployments. Depending on your workflow, assigning a custom domain to a specific branch could also work – https://vercel.com/guides/set-up-a-staging-environment-on-vercel

We have a ticket  open for investigation into the error you discovered, but I don't have any news on that front. If you have any additional details to share with the team to help with their investigation, I would be happy to add them to the ticket for you.