Open Elix3r opened 1 year ago
Is it possible to generate azure SAS tokens using any of the existing modules?
azure_rm_storageaccount_sas
azure_rm_storageaccount
name: Create SAS token for blob storage hosts: localhost gather_facts: no collections:
azure.azcollection
tasks:
name: Get storage account information azure_rm_storageaccount_info: resource_group: name: register: storage_account_info
name: Generate SAS token for blob service azure_rm_storageaccount_sas: resource_group: account_name: services: b resource_types: o permissions: "rwdlf" expiry: "{{ ansible_date_time.date|date_add(180, 'days')|strftime('%Y-%m-%dT%H:%MZ') }}" protocol: https https_only: true signed_resource: c signed_version: '2021-08-01' signed_resource_id: "/blob/{{ storage_account_info['results'][0]['id'] }}" register: sas_token_result
name: Display SAS token debug: var: sas_token_result.sas_token
@Elix3r Do you want to generate a shared access token for the container or an access key for the storage account? Can you describe your requirements in detail? Thank you!
SUMMARY
Is it possible to generate azure SAS tokens using any of the existing modules?
ISSUE TYPE
azure_rm_storageaccount_sas
COMPONENT NAME
azure_rm_storageaccount
ADDITIONAL INFORMATION
Something like this
name: Create SAS token for blob storage hosts: localhost gather_facts: no collections:
azure.azcollection
tasks:
name: Get storage account information azure_rm_storageaccount_info: resource_group:
name:
register: storage_account_info
name: Generate SAS token for blob service azure_rm_storageaccount_sas: resource_group:
account_name:
services: b
resource_types: o
permissions: "rwdlf"
expiry: "{{ ansible_date_time.date|date_add(180, 'days')|strftime('%Y-%m-%dT%H:%MZ') }}"
protocol: https
https_only: true
signed_resource: c
signed_version: '2021-08-01'
signed_resource_id: "/blob/{{ storage_account_info['results'][0]['id'] }}"
register: sas_token_result
name: Display SAS token debug: var: sas_token_result.sas_token