Connecting bitbucket repo which is not expose on the internet
Asked by sai:

Hi Team,

We are trying to create a service connection for bit bucket from Azure Devops but receiving following error.

Unauthorized request. Bitbucket returned the error: 'VS30063: You are not authorized to access <https://api.bitbucket.org>.'

**My URL is not accessible over the internet.**

Need bitbuckets team help to understand what settings can be changed to make it accessible (API access/non-Interactive)

My URL is : "<https://codecloud.web.att.com/projects/>"

![ErrorSnippet.PNG](/t5/image/serverpage/image-id/248704iEADD2C17406618B9/image-size/large?v=v2&px=999 "ErrorSnippet.PNG")

Thanks,

Sainath


Answers:
author: sai
body: Hi Syahrul,

We tried with both the options which you have shared.

**1.OAuth:**

When we are using the OAuth, it asking the @ email id. But we are using Mechid to login into the codecloud it doesn't have the domain name. We tried creating the service connection with Mechid and password getting below error.

**Unauthorized request. Bitbucket returned the error: 'VS30063: You are not authorized to access <https://api.bitbucket.org>.'**

2.**Basic Authentication:**

In Basic Authentication method, I am unable to create the **APP Password.** Not able to figure out the option to create the app password in my bitbucket UI as per the instructions shared on App Password Hyperlink.

Please find the attached screenshots for the same. And let me know if any other way to fix this issue.

**OAuth Issue:**

![OAuth.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/249718iD96C14C3FDF4A4B4/image-size/large?v=v2&px=999 "OAuth.PNG")

**App_Password unable to create, Not finding the given options in my UI.**

![App_Password.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/249719iC4BFC8C2022075E7/image-size/large?v=v2&px=999 "App_Password.PNG")

Thanks,

Sainath

comments: author: Syahrul
body: G'day [@sai](/t5/user/viewprofilepage/user-id/5183696)

It appears that you are using Bitbucket Server instead of Bitbucket Cloud, so the suggestions I previously provided may not be applicable since they are intended for the cloud version only.

As I am not an expert in Bitbucket Server, I may not be able to assist you much further. However, I did find some documentation that may help you with configuring your Bitbucket Server with Azure.

* <https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/on-premises-bitbucket?view=azure-devops>

Cheers,  
Syahrul


author: Syahrul
body: G'day [@sai](/t5/user/viewprofilepage/user-id/5183696), and welcome to the community!

To connect your Azure instance to Bitbucket Cloud you have the following options :

* **OAuth** : you will be redirected to Bitbucket website and will have to grant Azure access. The Bitbucket account you are logged in to while creating the connection should be an **administrator** of the workspace.
* **Basic Authentication** (username and app password): Create a service connection in Azure using your **bitbucket username** (not email address) and an [App Password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/) (not your account password) with the required permissions. You can try creating an App Password with full permissions and check how it goes.

Microsoft has detailed documentation on how to configure the connection to Bitbucket Cloud, which covers both scenarios above, and you can find it in the following link :

* [https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/bitbucket?view=azure-devops\&tabs=yaml](https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/bitbucket?view=azure-devops&tabs=yaml)

Hope that helps!

Cheers,  
Syahrul

comments: author: sai
body: Hi Syahrul,

Thanks for your valuable response. I will follow the given steps to get the source code from repo and will update you.

Thanks,

Sainath


Tags: bitbucket-server

server