One can publicly access the URL of a file in the repository of a publicly visible project or fetch its contents using the rest API.
Example: https://dev.azure.com/ayn/PowerShell/_git/AzIaaS?path=/README.md&_a=preview
fetch("https://dev.azure.com/ayn/PowerShell/_apis/git/repositories/4d348186-f42e-4ea5-9ed0-ec47530caee1/items?path=/README.md&api-version=7.1-preview.1")
.then(response => response.text())
.then(data => document.getElementById('code').textContent = data)
<pre id="code"></pre>
However, the approach shared in this answer doesn't work without a PAT. The URL below works on the browser when the user is logged in but not otherwise, even though it's a public repository.
Raw content URL: https://dev.azure.com/ayn/PowerShell/_apis/sourceProviders/tfsgit/filecontents?&repository=AzIaaS&commitOrBranch=main&api-version=7.0&path=/README.md
Is there a way to get the raw content URL of a public repository file that can be anonymously accessed from the browser?