logicapps icon indicating copy to clipboard operation
logicapps copied to clipboard

Generate-Connections.ps1 throws 404 on Get-AzResource -ResourceId

Open xaviergxf opened this issue 2 years ago • 0 comments

Hello,

I was executing the Generate-Connections.ps1 file to generate the necessary connections on Azure Devops and i had the following error: The API connection could not be found 404 Not Found OperationID xxxx

on the following block of the ps1 script line "Get-AzResource -ResourceId $_.id":

Function Get-ApiConnections {
  $apiConnections = @{}
  $resources = Get-AzResource -ResourceGroupName $resourceGroup -ResourceType Microsoft.Web/connections
  $resources | ForEach-Object {
    $name = $_.Name;
    Write-Host 'Found API connector: '$name
    $connectionResource = Get-AzResource -ResourceId $_.id
    $apiConnections["$name"] = @{
      "api"                  = @{
        "id" = $connectionResource.Properties.api.id
      };
      "connection"           = @{
        "id" = $_.Id.ToLower();
      };
      "connectionRuntimeUrl" = $connectionResource.Properties.connectionRuntimeUrl;
      "authentication"       = @{
        "type" = "ManagedServiceIdentity"
      }
    }
  }
  return $apiConnections;
}

How is this possible? No one else was working on this resource at the time. Even on Azure portal once deleting a Api Connection it seems the resource is on "limbo" state, half dead, half alive 😅. Is this a known bug? Can anyone help?

Thanks

xaviergxf avatar Jun 03 '22 07:06 xaviergxf