Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
404 stars 195 forks source link

AZDO pipeline support does not recognize visualstudio.com as a valid AZDO host #1072

Closed KSchlobohm closed 2 months ago

KSchlobohm commented 1 year ago

Output from azd version

azd version 0.3.0-beta.5 (commit 38169d7067ac73dc4e214e6913bee5e5359b8b15)

Output from az version

{
  "azure-cli": "2.41.0",
  "azure-cli-core": "2.41.0",
  "azure-cli-telemetry": "1.0.8",
  "extensions": {
    "containerapp": "0.3.13",
    "log-analytics": "0.2.2",
    "rdbms-connect": "1.0.4"
  }
}

Describe the bug Receiving an error that's blocking my ability to setup AZDO pipelines until I change my origin URL

To Reproduce

  1. sign into an AZDO repo that automatically redirects you to VisualStudio.com
  2. clone code from AZDO repo
  3. run azd pipeline config --provider azdo
  4. observe error message

Error: ensuring git remote: existing remote is not an Azure DevOps host

Expected behavior Expected that other valid URLs would be recognized example
<Azure DevOps Org Name>.visualstudio.com

Environment

Additional context

KSchlobohm commented 1 year ago

Also blocked with a URL of the pattern similar to:

 https://dev.azure.com/mydevOpsOrgName/myProjectName
rajeshkamal5050 commented 1 year ago

@hattan can you help triage this?

hattan commented 1 year ago

Thanks for the feedback @KSchlobohm. This is due to how we validate Azure DevOps urls to ensure that existing remotes match a users selection when running azd pipeline config --provider azdo

We can definitely add support for the visualstudio.com domain.

Until that is available there is a workaround which is to set the organization to use the newer dev.azure.com domain. This is can be found under Organization Settings -> General

https://dev.azure.com//_settings/organizationOverview

image

https://dev.azure.com/mydevOpsOrgName/myProjectName

In terms of this URL pattern, we do validate that https urls are specifically git remotes in this format. https://ORG_NAME>@dev.azure.com/<ORG_NAME//_git/

but we will investigate further and look into adding the visualstudio.com domain as well.

tonyeung commented 1 year ago

I'd like to put it out there that I don't have permissions to change the ADO settings for my org. As a result, the workaround by @hattan below does not work for me.

Thanks for the feedback @KSchlobohm. This is due to how we validate Azure DevOps urls to ensure that existing remotes match a users selection when running azd pipeline config --provider azdo

We can definitely add support for the visualstudio.com domain.

Until that is available there is a workaround which is to set the organization to use the newer dev.azure.com domain. This is can be found under Organization Settings -> General

https://dev.azure.com//_settings/organizationOverview

image

https://dev.azure.com/mydevOpsOrgName/myProjectName

In terms of this URL pattern, we do validate that https urls are specifically git remotes in this format. https://ORG_NAME>@dev.azure.com/<ORG_NAME//_git/

but we will investigate further and look into adding the visualstudio.com domain as well.

bmallen1 commented 9 months ago

Hello, I'm also running into this issue.

azd cli version 1.5.1

error message after entering PAT: ERROR: ensuring git remote: existing remote is not an Azure DevOps host

git remote url: https://dev.azure.com/organization/Project/_git/ProjectRepo

sunggonm commented 7 months ago

It only supports this pattern by now according to https://github.com/Azure/azure-dev/blob/4a1aba4535d394c5f7ccc2d46576e4b8f3fb8681/cli/azd/pkg/pipeline/azdo_provider.go#L425

https://ORG_NAME>@dev.azure.com/<ORG_NAME//_git/ After cloning using the pattern and it seems work.

geegee4iee commented 3 months ago

Hi? Is there any update on this as it's not possible to change the domain pattern in my situation.

vhvb1989 commented 2 months ago

@geegee4iee , I've created a PR for it