title: "The remote name could not be resolved" when running an Azure DevOps self-hosted build agent in Service Fabric
body: <p>I can successfully start a self-hosted agent on my Windows 10 machine following this article:</p>
  <p><a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/docker?view=azure-devops#windows" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/docker?view=azure-devops#windows</a></p>
  <p>However when I try to start the very same Docker image in <em>Service Fabric</em> with Windows Server 20H2 nodes, I get these container log entries:</p>
  <pre><code>1. Determining matching Azure Pipelines agent...
  Invoke-RestMethod : The remote name could not be resolved: 'dev.azure.com'
  At C:\azp\start.ps1:34 char:12
  + $package = Invoke-RestMethod -Headers @{Authorization=(&quot;Basic $base64 ...
  +            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:Htt
     pWebRequest) [Invoke-RestMethod], WebException
      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
     ll.Commands.InvokeRestMethodCommand
  </code></pre>
  <p><strong>Dockerfile</strong></p>
  <pre><code>FROM mcr.microsoft.com/windows/servercore:20H2
  
  WORKDIR /azp
  
  COPY start.ps1 .
  
  CMD powershell .\start.ps1
  </code></pre>
  <p><strong>ApplicationManifest.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;ApplicationManifest ApplicationTypeName=&quot;build-agent-20H2&quot; ApplicationTypeVersion=&quot;20201228.5&quot;
    xmlns=&quot;http://schemas.microsoft.com/2011/01/fabric&quot;
    xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;
    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  
    &lt;ServiceManifestImport&gt;
      &lt;ServiceManifestRef ServiceManifestName=&quot;Package&quot; ServiceManifestVersion=&quot;20201228.5&quot; /&gt;
      &lt;EnvironmentOverrides CodePackageRef=&quot;buildagent.Code&quot;&gt;
        &lt;EnvironmentVariable Name=&quot;AZP_URL&quot; Value=&quot;https://dev.azure.com/myaccount&quot; /&gt;
        &lt;EnvironmentVariable Name=&quot;AZP_TOKEN&quot; Value=&quot;mypat&quot; /&gt;
        &lt;EnvironmentVariable Name=&quot;AZP_AGENT_NAME&quot; Value=&quot;myagentname&quot; /&gt;
        &lt;EnvironmentVariable Name=&quot;AZP_POOL&quot; Value=&quot;mypoolname&quot; /&gt;
      &lt;/EnvironmentOverrides&gt;
      &lt;Policies&gt;
        &lt;ServicePackageResourceGovernancePolicy CpuCores=&quot;1&quot;/&gt;
        &lt;ResourceGovernancePolicy CodePackageRef=&quot;buildagent.Code&quot; MemoryInMB=&quot;1024&quot; /&gt;
        &lt;ContainerHostPolicies CodePackageRef=&quot;buildagent.Code&quot; UseTokenAuthenticationCredentials=&quot;true&quot;&gt;
          &lt;HealthConfig IncludeDockerHealthStatusInSystemHealthReport=&quot;true&quot; RestartContainerOnUnhealthyDockerHealthStatus=&quot;false&quot; TreatContainerUnhealthyStatusAsError=&quot;false&quot; /&gt;
        &lt;/ContainerHostPolicies&gt;
      &lt;/Policies&gt;
    &lt;/ServiceManifestImport&gt;
    &lt;DefaultServices&gt;
      &lt;Service Name=&quot;buildagent&quot;&gt;
        &lt;StatelessService ServiceTypeName=&quot;buildagentType&quot; InstanceCount=&quot;1&quot;&gt;
          &lt;SingletonPartition /&gt;
        &lt;/StatelessService&gt;
      &lt;/Service&gt;
    &lt;/DefaultServices&gt;
  &lt;/ApplicationManifest&gt;
  </code></pre>
  <p><strong>ServiceManifest.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;ServiceManifest xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;
    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; Name=&quot;Package&quot; Version=&quot;20201228.5&quot;
    xmlns=&quot;http://schemas.microsoft.com/2011/01/fabric&quot;&gt;
    &lt;ServiceTypes&gt;
      &lt;StatelessServiceType ServiceTypeName=&quot;buildagentType&quot; UseImplicitHost=&quot;true&quot;&gt;
      &lt;/StatelessServiceType&gt;
    &lt;/ServiceTypes&gt;
    &lt;CodePackage Name=&quot;buildagent.Code&quot; Version=&quot;20201228.5&quot;&gt;
      &lt;EntryPoint&gt;
        &lt;ContainerHost&gt;
          &lt;ImageName&gt;myacr.azurecr.io/build-agent-20h2:20201228.5&lt;/ImageName&gt;
          &lt;Commands&gt;
          &lt;/Commands&gt;
        &lt;/ContainerHost&gt;
      &lt;/EntryPoint&gt;
      &lt;EnvironmentVariables&gt;
        &lt;EnvironmentVariable Name=&quot;AZP_URL&quot; Value=&quot;&quot; /&gt;
        &lt;EnvironmentVariable Name=&quot;AZP_TOKEN&quot; Value=&quot;&quot; /&gt;
        &lt;EnvironmentVariable Name=&quot;AZP_AGENT_NAME&quot; Value=&quot;&quot; /&gt;
        &lt;EnvironmentVariable Name=&quot;AZP_POOL&quot; Value=&quot;&quot; /&gt;
      &lt;/EnvironmentVariables&gt;
    &lt;/CodePackage&gt;
  &lt;/ServiceManifest&gt;
  </code></pre>
  <p>I also tried without these specs:</p>
  <ul>
  <li>ServicePackageResourceGovernancePolicy</li>
  <li>ResourceGovernancePolicy</li>
  <li>HealthConfig</li>
  </ul>
  <p>and I wonder whether I can bring up a container in <em>Service Fabric</em> without having a HTTP or TCP endpoint.</p>
  <p><strong>EDIT:</strong></p>
  <p>another observation: When I SSH/remote onto one of the nodes where I deployed the image to and <code>docker run -it</code> the image directly, the remote name can be resolved and the installation procedure works (?). So it seams <em>SF</em> starts the container differently.</p>
  <p><strong>EDIT 2:</strong></p>
  <p>Tried with a simplified <code>start.ps1</code></p>
  <pre><code>Invoke-WebRequest -OutFile dotnet.zip https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.2.402/dotnet-sdk-2.2.402-win-x64.zip
  Read-Host
  </code></pre>
  <p>brings same error. Comparing <code>docker inspect</code> on SF controlled container and directly started container I see a deviation which maybe relevant:</p>
  <p><strong>SF</strong> (not working)</p>
  <pre><code>        &quot;Dns&quot;: [],
          &quot;DnsOptions&quot;: [],
          &quot;DnsSearch&quot;: [],
  ...
          &quot;Networks&quot;: {
              &quot;nat&quot;: {
                  &quot;IPAMConfig&quot;: null,
                  &quot;Links&quot;: null,
                  &quot;Aliases&quot;: null,
                  &quot;NetworkID&quot;: &quot;b52a59a54d97f56f8fc866c0f742588023333ff1cb10b2c536be21d6745d609d&quot;,
                  &quot;EndpointID&quot;: &quot;bc20ebb2124467f5135aefeefd7e3d38c14338479f7a5dbd04fd274dd0fa3ddf&quot;,
                  &quot;Gateway&quot;: &quot;192.168.80.1&quot;,
                  &quot;IPAddress&quot;: &quot;192.168.81.196&quot;,
                  &quot;IPPrefixLen&quot;: 24,
  </code></pre>
  <p><strong>direct</strong> (working)</p>
  <pre><code>        &quot;Dns&quot;: [
              &quot;10.1.0.211&quot;
          ],
          &quot;DnsOptions&quot;: [
              &quot;ndots:1&quot;
          ],
          &quot;DnsSearch&quot;: [
              &quot;build-agent-20H2&quot;
          ],
  ...
          &quot;Networks&quot;: {
              &quot;nat&quot;: {
                  &quot;IPAMConfig&quot;: null,
                  &quot;Links&quot;: null,
                  &quot;Aliases&quot;: null,
                  &quot;NetworkID&quot;: &quot;b52a59a54d97f56f8fc866c0f742588023333ff1cb10b2c536be21d6745d609d&quot;,
                  &quot;EndpointID&quot;: &quot;&quot;,
                  &quot;Gateway&quot;: &quot;&quot;,
                  &quot;IPAddress&quot;: &quot;&quot;,
                  &quot;IPPrefixLen&quot;: 0,
  </code></pre>