How to Implement a Custom Service Endpoint in Azure DevOps Server Acting as a Proxy?

I’m trying to create a custom service endpoint in Azure DevOps Server that acts as a proxy to download files from an external S3 server. The goal is to allow users to download these files through Azure DevOps without exposing the S3 server URL directly. Here are the details of what I’m trying to achieve:

Manifest File: I have a manifest file for my Azure DevOps extension that includes a custom service endpoint contribution.

{
    "manifestVersion": 1,
    "id": "s3Proxy",
    "publisher": "timofei-publisher",
    "version": "1.0.7",
    "name": "S3 Proxy Extension",
    "description": "Azure DevOps extension sample",
    "categories": [
        "Azure Pipelines"
    ],
    "targets": [
        {
            "id": "Microsoft.VisualStudio.Services"
        }
    ],
    "scopes": [
        "vso.serviceendpoint_manage",
        "vso.serviceendpoint_query"
    ],
    "contributions": [
        {
            "id": "custom-service-endpoint",
            "type": "ms.vss-web.service-endpoint",
            "description": "Custom service endpoint for Azure DevOps",
            "properties": {
                "name": "CustomServiceEndpoint",
                "uri": "/_apis/customserviceendpoint",
                "scopes": ["vso.serviceendpoint_manage", "vso.serviceendpoint_query"]
            }
        }
    ],
    "files": [
        {
            "path": "bin/*",
            "addressable": true
        }
    ]
}

Controller Code: I have implemented a custom controller in ASP.NET MVC to handle the proxy logic.

using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace S3Proxy.Controllers
{
    public class CustomServiceEndpointController : Controller
    {
        [HttpGet]
        [Route("_apis/customserviceendpoint")]
        public async Task<ActionResult> GetLinkStream(string filePath)
        {
            string baseUrl = "https://storage.yandexcloud.net/";
            string imageUrl = $"{baseUrl}{filePath}";

            using (HttpClient httpClient = new HttpClient())
            {
                try
                {
                    byte[] fileBytes = await httpClient.GetByteArrayAsync(imageUrl);
                    return File(fileBytes, "application/octet-stream");
                }
                catch (HttpRequestException ex)
                {
                    Console.WriteLine($"Error downloading file: {ex.Message}");
                    return new HttpStatusCodeResult(500, $"Error downloading file: {ex.Message}");
                }
            }
        }
    }
}

My Questions:
Is this the correct approach to create a custom service endpoint within Azure DevOps Server to act as a proxy for downloading files from an external S3 server?
Can I use a relative URL in the manifest to ensure the endpoint works correctly across different Azure DevOps Server instances?
How do I ensure proper authentication and authorization for this endpoint within Azure DevOps?
Are there any best practices or potential pitfalls I should be aware of when implementing this proxy logic in Azure DevOps Server?
Any guidance or examples would be greatly appreciated!

New contributor

user25161451 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật