-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Feature description
/vsiaz/ driver does not respect Azure Government Cloud endpoints
Summary
The /vsiaz/ virtual file system driver does not properly support Azure Government Cloud (or other sovereign clouds) endpoints. When configured with Gov Cloud storage credentials, GDAL still attempts to connect to commercial cloud endpoints (core.windows.net) instead of the configured Gov Cloud endpoints (core.usgovcloudapi.net).
Environment
- GDAL Version: 3.12.1
- Rasterio Version: 1.5.0
- Platform: Azure Functions (Linux), Python 3.12
- Azure Cloud: US Government Cloud (
core.usgovcloudapi.net)
Expected Behavior
When using /vsiaz/ with Azure Government Cloud storage credentials, GDAL should:
- Respect the
EndpointSuffixfrom the connection string or environment variables - Connect to
https://<account>.blob.core.usgovcloudapi.net - Successfully read Cloud Optimized GeoTIFFs using HTTP range requests
Actual Behavior
GDAL attempts to connect to the commercial cloud endpoint regardless of configuration:
CURL error: Could not resolve host: <account>.blob.core.windows.net
Even when Gov Cloud credentials are provided, the driver constructs URLs using core.windows.net instead of core.usgovcloudapi.net.
Steps to Reproduce
Using Python/Rasterio:
import rasterio
import rasterio.env
import os
# Set up Gov Cloud credentials
os.environ['AZURE_STORAGE_ACCOUNT'] = 'mygovaccount'
os.environ['AZURE_STORAGE_ACCESS_KEY'] = 'mykey'
os.environ['AZURE_STORAGE_CONNECTION_STRING'] = 'DefaultEndpointsProtocol=https;AccountName=mygovaccount;AccountKey=mykey;EndpointSuffix=core.usgovcloudapi.net'
# Attempt to open file from Gov Cloud storage
with rasterio.env.Env(
AZURE_STORAGE_ACCOUNT='mygovaccount',
AZURE_STORAGE_ACCESS_KEY='mykey',
AZURE_STORAGE_AUTH_TYPE='Key'
):
with rasterio.open('/vsiaz/mycontainer/myfile.tif') as src:
print(src.meta)Result: Connection fails with DNS error trying to resolve mygovaccount.blob.core.windows.net
Using gdalinfo CLI:
export AZURE_STORAGE_ACCOUNT=mygovaccount
export AZURE_STORAGE_ACCESS_KEY=mykey
gdalinfo /vsiaz/mycontainer/myfile.tifResult: Same DNS resolution error
Attempted Workarounds
The following environment variables and configurations were attempted without success:
-
Setting
AZURE_STORAGE_CONNECTION_STRINGwithEndpointSuffix=core.usgovcloudapi.net- Not respected by
/vsiaz/driver
- Not respected by
-
Setting
AZURE_STORAGE_BLOB_ENDPOINTAZURE_STORAGE_BLOB_ENDPOINT='https://mygovaccount.blob.core.usgovcloudapi.net'
- Causes GDAL to try resolving
core.usgovcloudapi.netas a hostname
- Causes GDAL to try resolving
-
Setting
CPL_AZURE_ENDPOINTCPL_AZURE_ENDPOINT='core.usgovcloudapi.net'
- Same DNS resolution issue
-
Using
/vsicurl/with full URLwith rasterio.open('/vsicurl/https://mygovaccount.blob.core.usgovcloudapi.net/container/file.tif') as src:
- Works but requires manual SAS token generation and doesn't leverage Azure authentication
Impact
This limitation affects:
- Azure Government Cloud users (US federal agencies, DoD, etc.)
- Azure China Cloud users (
core.chinacloudapi.cn) - Azure Germany Cloud users (
core.cloudapi.de)
These users cannot leverage Cloud Optimized GeoTIFF streaming capabilities with GDAL/Rasterio and must download entire files, defeating the purpose of COG format for large datasets.
Additional context
No response