fix postgresql

This commit is contained in:
Carlos Polop
2025-04-25 04:50:59 +02:00
parent 6229cc5c3f
commit 227bd60d9d

View File

@@ -51,13 +51,25 @@ az postgres flexible-server identity update \
--system-assigned Enabled
```
```sql
-- Make sure the extension is installed
CREATE EXTENSION IF NOT EXISTS azure_storage;
CREATE EXTERNAL DATA SOURCE ManagedIdentity
-- Login using storage keys
SELECT azure_storage.account_add('<storage-account>', '<storage-key>');
-- Login using managed identity
SELECT azure_storage.account_add(azure_storage.account_options_managed_identity('<storage-account>', 'blob'));
-- List configured accounts
SELECT * FROM azure_storage.account_list();
-- List all the files in the storage account
SELECT *
FROM azure_storage.blob_list(
'<storage-account>',
'<container>'
);
-- Access one file inside the storage account
SELECT *
FROM azure_storage.blob_get(
'<storage-account>',
@@ -66,7 +78,6 @@ FROM azure_storage.blob_get(
decoder := 'text'
) AS t(content text)
LIMIT 1;
```
Additionally it is necesary to have the public access enabled if you want to access from a non private endpoint, to enable it: