Via https://ubuntu.com/esm#faq
"We're mirroring the repository on our internal Landscape server. Can we still get Ubuntu ESM if using Landscape? ESM is just a regular Ubuntu archive, but authenticated and served over HTTPS. Archive mirroring is already available in Landscape and is the only supported mechanism for mirroring the ESM archive."
# Extract login/pass
> cat /etc/apt/auth.conf.d/90ubuntu-advantage
> /usr/bin/aptly -config /etc/aptly.conf mirror create -architectures="amd64" -with-sources=false -with-udebs=false ubuntu-esm-trusty https://<login>:<pass>@esm.ubuntu.com/ubuntu trusty-updates
# Security repo
> aptly mirror show esm-ubuntu-trusty-security|grep packages
Number of packages: 841
# OR
> curl -v https://<login>:<pass>@esm.ubuntu.com/ubuntu
try this
sudo pro attach yourtoken
go to https://ubuntu.com/pro/dashboard for get your personal token
ubuntuadvantagelong="$(cat /etc/apt/auth.conf.d/90ubuntu-advantage | grep esm.ubuntu.com/apps| sed 's|machine esm.ubuntu.com/apps/ubuntu/ login bearer password ||' | sed 's| # ubuntu-advantage-tools||')"
ubuntuadvantage=$(echo bearer:${ubuntuadvantagelong:0:146})
encode result $ubuntuadvantage to base64 in variable
use header
Authorization: Basic $ubuntuadvantageinbase64encode
work