Skip to content

Commit 9a8b3b1

Browse files
committed
fix postgresql
1 parent 0eae138 commit 9a8b3b1

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

src/pentesting-cloud/azure-security/az-privilege-escalation/az-postgresql-privesc.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,25 @@ az postgres flexible-server identity update \
5151
--system-assigned Enabled
5252
```
5353
```sql
54-
54+
-- Make sure the extension is installed
5555
CREATE EXTENSION IF NOT EXISTS azure_storage;
5656

57-
CREATE EXTERNAL DATA SOURCE ManagedIdentity
58-
57+
-- Login using storage keys
5958
SELECT azure_storage.account_add('<storage-account>', '<storage-key>');
59+
-- Login using managed identity
60+
SELECT azure_storage.account_add(azure_storage.account_options_managed_identity('<storage-account>', 'blob'));
6061

62+
-- List configured accounts
63+
SELECT * FROM azure_storage.account_list();
64+
65+
-- List all the files in the storage account
66+
SELECT *
67+
FROM azure_storage.blob_list(
68+
'<storage-account>',
69+
'<container>'
70+
);
71+
72+
-- Access one file inside the storage account
6173
SELECT *
6274
FROM azure_storage.blob_get(
6375
'<storage-account>',
@@ -66,7 +78,6 @@ FROM azure_storage.blob_get(
6678
decoder := 'text'
6779
) AS t(content text)
6880
LIMIT 1;
69-
7081
```
7182

7283
Additionally it is necesary to have the public access enabled if you want to access from a non private endpoint, to enable it:

0 commit comments

Comments
 (0)