getsentry / self-hosted

Sentry, feature-complete and packaged up for low-volume deployments and proofs-of-concept
https://develop.sentry.dev/self-hosted/
Other
7.96k stars 1.78k forks source link

Receiving 400 - Bad Request when attempting to install Azure DevOps Integration #2627

Closed edgariscoding closed 11 months ago

edgariscoding commented 1 year ago

Environment

self-hosted (https://develop.sentry.dev/self-hosted/)

Steps to Reproduce

I accessed Organization Settings > Integrations. Clicked Add Installation for Azure DevOps.

Expected Result

I expected to be able to configure the integration.

Actual Result

image

This happens on my personal computer as well as my work computer.

Product Area

Settings - Integrations

Link

No response

DSN

No response

Version

23.11.0.dev0

getsantry[bot] commented 1 year ago

Assigning to @getsentry/support for routing ⏲️

getsantry[bot] commented 1 year ago

Routing to @getsentry/product-owners-settings-integrations for triage ⏲️

snigdhas commented 1 year ago

Hi @edgariscoding, can you confirm that your Azure Org's has third-party access via OAuth enabled? see https://docs.sentry.io/product/integrations/source-code-mgmt/azure-devops/#install

edgariscoding commented 1 year ago

Yes it does

image
edgariscoding commented 1 year ago

This happens before it even gets to the login page though, when I see this error it doesnt even know my Azure account.

leedongwei commented 1 year ago

@edgariscoding Hello, I'm not able to replicate this. My suspicion is that Azure is unhappy with the setup of your self-hosted Sentry instance (e.g. invalid SSL cert, or any other random small things). Can you take a look at the browser dev tools to check if they have a more informative error message?

edgariscoding commented 1 year ago

@leedongwei

Does this help?

image
leedongwei commented 1 year ago

Can you try installing this extension https://chrome.google.com/webstore/detail/saml-ws-federation-and-oa/hkodokikbjolckghdnljbkbhacbhpnkb and running it to see if there's any oddities during the redirect from Sentry to Azure DevOps?

edgariscoding commented 1 year ago

@leedongwei

I checked all 6 traces and I dont see any errors... what should I be looking for?

Screenshot 2023-12-02 at 3 55 40 PM
edgariscoding commented 1 year ago

Do I need to do this?

These instructions don't mention anything about creating an application on Azure.

I assumed all of this happened on its own after I clicked on Add Installation and authenticated with Azure.

edgariscoding commented 1 year ago

Yeah that was the issue. The instructions are a bit confusing for Sentry Self Hosted Azure DevOps Integration because they're separated. I accidentally ran into the correct page by googling.

Step 1: Create an Azure application:

Log into your Azure DevOps account, creating one if needed. Ensure you have a project set up.

To use the Azure DevOps integration you'll need to create an application. To start, visit this page to register the app.

When configuring the app, use the following values:

Setting Value
Authorization callback URL {YOUR_DOMAIN}/extensions/vsts/setup/
Authorized Scopes Code (read), Work Items (read and write), Service Endpoints (read, query and manage), Graph (read)

Take note of your App ID and Client Secret (the long one you have to click to show) and add those to config.yml like this:

# Azure DevOps #
vsts.client-id: your-app-id
vsts.client-secret: your-client-secret

Note: The config.yml file does NOT contain a placeholder for Azure DevOps like it does for Slack, Discord, and GitHub. These must be appended at the end.

Step 2: Install Azure DevOps Integration in Sentry

  1. To install this integration, you need to have Sentry organization owner, manager, or admin permissions, as well as Azure organization owner permissions, or be a user in the Project Collections Administrators group.

  2. Go to your Azure Org's settings to make sure third-party access via OAuth is enabled.

  3. In Sentry.io, navigate to Settings > Integrations > Azure DevOps and click "Add Installation".

    Install Azure DevOps integration

  4. An Azure DevOps install window should pop up. Select the Azure DevOps account you'd like to link with Sentry, and press Submit.

    Configure Azure DevOps

Azure DevOps should now be enabled for all projects under your Sentry organization, but you'll need to configure the features below.

edgariscoding commented 1 year ago

But as luck would have it, I'm still not having luck.

I'm now stuck here after selecting the azure devops organization.

When I saved the config.yml changes, I did docker compose restart. Do I need to run the ./install.sh file again?

image

But the permission incorrect:

Screenshot 2023-12-02 at 4 38 18 PM
malwilley commented 12 months ago

I'm going to transfer this to the self-hosted repo as this appears to be a configuration issue.

hubertdeng123 commented 12 months ago

@edgariscoding You may need to try docker compose down && docker compose up -d

edgariscoding commented 12 months ago

@hubertdeng123 Do I need to be a member of Azure DevOps Project Collection Administrators?

I have everything else set up but im not a member of that group, so guess I'd have to get my boss to create a sentry account and add the sentry integration himself

edgariscoding commented 11 months ago

I figured it out. It's because I was not a member of Project Collection Administrators.

I tried to get my boss to do it for me but he was getting an error, probably due to the fact that I was the one that created the azure app.

I had him add me to the PCA group for 2 minutes while I set up the integration and it worked.

Now I have other questions but I'll do that as a separate issue.

Thanks for the replies!