Azure 创建docker生成时出错-无法加载源响应状态代码的服务索引并不表示成功:403

Azure 创建docker生成时出错-无法加载源响应状态代码的服务索引并不表示成功:403,azure,docker,nuget,Azure,Docker,Nuget,在Azure管道中创建docker生成时出错-我收到错误: 错误:无法加载源代码的服务索引https://pkgs.dev.azure.com/XXX/_packaging/XXX/nuget/v3/index.json. 错误:响应状态代码不表示成功:403(不允许请求的操作。) 我的docker文件: FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build ARG PAT="xxxxx" COPY . /s

在Azure管道中创建docker生成时出错-我收到错误:

错误:无法加载源代码的服务索引https://pkgs.dev.azure.com/XXX/_packaging/XXX/nuget/v3/index.json.

错误:响应状态代码不表示成功:403(不允许请求的操作。)

我的docker文件:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
ARG PAT="xxxxx"

COPY . /src
WORKDIR "/src/xxx/xxx/xxx"

RUN wget -qO- https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
ENV NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED true
ENV VSS_NUGET_EXTERNAL_FEED_ENDPOINTS "{\"endpointCredentials\": [{\"endpoint\":\"https://pkgs.dev.azure.com/xxx/_packaging/TOS-Feed/nuget/v3/index.json\", \"username\":\"PAT\", \"password\":\"${PAT}\"}]}"
RUN git config --global core.autocrlf true \
 && dotnet build   "Application.csproj" -c Release -o /app-build  \
 && dotnet publish "Application.csproj" -c Release -o /app-publish



FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS final
COPY --from=build /app-publish /app
WORKDIR /app
ENTRYPOINT ["dotnet", "Application.dll"]
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <!-- Allow NuGet to download missing packages -->
    <add key="enabled" value="True" />
    <!-- Automatically check for missing packages during build in Visual Studio -->
    <add key="automatic" value="True" />
  </packageRestore>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="TOS-Feed" value="https://pkgs.dev.azure.com/XXX/_packaging/TOS-Feed/nuget/v3/index.json" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>
我的NuGet.config文件:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
ARG PAT="xxxxx"

COPY . /src
WORKDIR "/src/xxx/xxx/xxx"

RUN wget -qO- https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
ENV NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED true
ENV VSS_NUGET_EXTERNAL_FEED_ENDPOINTS "{\"endpointCredentials\": [{\"endpoint\":\"https://pkgs.dev.azure.com/xxx/_packaging/TOS-Feed/nuget/v3/index.json\", \"username\":\"PAT\", \"password\":\"${PAT}\"}]}"
RUN git config --global core.autocrlf true \
 && dotnet build   "Application.csproj" -c Release -o /app-build  \
 && dotnet publish "Application.csproj" -c Release -o /app-publish



FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS final
COPY --from=build /app-publish /app
WORKDIR /app
ENTRYPOINT ["dotnet", "Application.dll"]
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <!-- Allow NuGet to download missing packages -->
    <add key="enabled" value="True" />
    <!-- Automatically check for missing packages during build in Visual Studio -->
    <add key="automatic" value="True" />
  </packageRestore>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="TOS-Feed" value="https://pkgs.dev.azure.com/XXX/_packaging/TOS-Feed/nuget/v3/index.json" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>


请提供帮助。

您有防火墙吗?