Closed berndverst closed 6 months ago
@tanyasethi-msft could you please take a look at this? Feel free to ping me internally.
In case the type of Storage account plays a role, here are the details:
az storage account show -n cnagstorage
{
"accessTier": "Hot",
"accountMigrationInProgress": null,
"allowBlobPublicAccess": false,
"allowCrossTenantReplication": false,
"allowSharedKeyAccess": null,
"allowedCopyScope": null,
"azureFilesIdentityBasedAuthentication": null,
"blobRestoreStatus": null,
"creationTime": "2024-02-28T01:58:14.017250+00:00",
"customDomain": null,
"defaultToOAuthAuthentication": null,
"dnsEndpointType": null,
"enableHttpsTrafficOnly": true,
"enableNfsV3": null,
"encryption": {
"encryptionIdentity": null,
"keySource": "Microsoft.Storage",
"keyVaultProperties": null,
"requireInfrastructureEncryption": null,
"services": {
"blob": {
"enabled": true,
"keyType": "Account",
"lastEnabledTime": "2024-02-28T01:58:14.235960+00:00"
},
"file": {
"enabled": true,
"keyType": "Account",
"lastEnabledTime": "2024-02-28T01:58:14.235960+00:00"
},
"queue": null,
"table": null
}
},
"extendedLocation": null,
"failoverInProgress": null,
"geoReplicationStats": null,
"id": "/subscriptions/XXXXXXXXXXXXXXXXXXXXX/resourceGroups/beverst-dev/providers/Microsoft.Storage/storageAccounts/cnagstorage",
"identity": null,
"immutableStorageWithVersioning": null,
"isHnsEnabled": null,
"isLocalUserEnabled": null,
"isSftpEnabled": null,
"isSkuConversionBlocked": null,
"keyCreationTime": {
"key1": "2024-02-28T01:58:14.095336+00:00",
"key2": "2024-02-28T01:58:14.095336+00:00"
},
"keyPolicy": null,
"kind": "StorageV2",
"largeFileSharesState": null,
"lastGeoFailoverTime": null,
"location": "westus3",
"minimumTlsVersion": "TLS1_0",
"name": "cnagstorage",
"networkRuleSet": {
"bypass": "AzureServices",
"defaultAction": "Allow",
"ipRules": [],
"ipv6Rules": [],
"resourceAccessRules": null,
"virtualNetworkRules": []
},
"primaryEndpoints": {
"blob": "https://cnagstorage.blob.core.windows.net/",
"dfs": null,
"file": null,
"internetEndpoints": null,
"microsoftEndpoints": null,
"queue": null,
"table": null,
"web": "https://cnagstorage.z1.web.core.windows.net/"
},
"primaryLocation": "westus3",
"privateEndpointConnections": [],
"provisioningState": "Succeeded",
"publicNetworkAccess": null,
"resourceGroup": "beverst-dev",
"routingPreference": null,
"sasPolicy": null,
"secondaryEndpoints": null,
"secondaryLocation": null,
"sku": {
"name": "Premium_ZRS",
"tier": "Premium"
},
"statusOfPrimary": "available",
"statusOfSecondary": null,
"storageAccountSkuConversionStatus": null,
"tags": {},
"type": "Microsoft.Storage/storageAccounts"
}
Hi @berndverst , Thanks for reporting this issue!
This seems more like a documentation bug here, where offset: 0, count: 0
should not be a valid example.
This code piece here checks if both offset and count are zero, and if yes, it considers no range, and does not add it to the header list.
I will make changes in the documentation.
@tanyasethi-msft could you please provide a complete example that reads an arbitrary file or buffer and uploads the entire thing?
That's really the sample everyone is missing.
FWIW, I actually wrote other code to change offset and count values.. and everytime it would complain about other missing headers or incorrect header values.
A complete example is truly needed.
For example some unknowns here: Does a file have to be uploaded as multiple pages? If so what does the page size need to be?
We really need some clearer samples, and ideally there would be some convenience methods added to the SDK that can upload an entire file or buffer as pages using some sane defaults.
Bug Report
The
pageblob
module (submodule ofazblob
) does not set required headers when attempting to upload a page blob toPREMIUM
storageThe proxy test which replays existing recordings works fine (run via
go test -v --count=1
) but running a test against real Azure resources does not work.I set the Storage Account environment variable and made sure I have
Azure Storage Data Owner
permission. Authentication happened successfully via the DefaultAzureCredential which used my AzureCLICredential.https://github.com/Azure/azure-sdk-for-go/blob/476924417d9088bf5779517af24f8375cb567f4a/sdk/storage/azblob/pageblob/examples_test.go#L31-L112
SDK Versions:
go version
go version go1.22.0 darwin/arm64
I compiled the sample (by renaming the function to main and changing the package to main, and changing the container name to something I already had) to a binary
m
and then ran it like so:Here are the full logs with Azure Go SDK debug logs enabled: