azure icon indicating copy to clipboard operation
azure copied to clipboard

Azure_rm_storageblob - Share key authorization support

Open lukasmrtvy opened this issue 5 years ago • 4 comments

SUMMARY Share key authorization support, see https://docs.microsoft.com/en-us/azure/storage/common/storage-auth , Shared Key authorization.

ISSUE TYPE Feature Idea COMPONENT NAME azure_rm_storageblob module

ADDITIONAL INFORMATION Need to accept access_key parameter which is the value of shared authorization key

- name: Remove container foo
  azure_rm_storageblob:
    resource_group: testing
    storage_account_name: clh0002
    container: foo
    access_key: "{{ my_access_key }}"
    state: present

by @melezhik from https://github.com/ansible/ansible/issues/55350

lukasmrtvy avatar Aug 30 '20 17:08 lukasmrtvy

@lukasmrtvy Thanks for your submit this issue! We will investigate and add this feature! You are also welcome to add this feature!

Fred-sun avatar Sep 07 '20 06:09 Fred-sun

Hey, I'm also up'ing this, it's weird since the powershell module has support for Access Key yet the ansible module doesn't.

JonathanG3 avatar Jul 04 '22 13:07 JonathanG3

Any news on this?

Symbi0t avatar Jan 18 '23 13:01 Symbi0t

As a workaround, I used the builtin uri module. The Azure API is quite simple to use with the shared access tokens.

I used something like this, with my SAS URL cut in two environment variable, before and after the ?.

....
  vars:
    blob_name: yourblobname
    azure_sas_url: "{{ lookup('env', 'AZURE_SAS_URL') }}"
    azure_sas_token: "{{ lookup('env', 'AZURE_SAS_TOKEN') }}"
  tasks:
    - name: Upload blob to Azure
      ansible.builtin.uri:
        url: "{{ azure_sas_url }}/{{ blob_name }}?{{ azure_sas_token }}"
        method: PUT
        headers:
          x-ms-blob-type: BlockBlob
        src: "yourfile"
        status_code: 201

fungiboletus avatar Oct 10 '23 11:10 fungiboletus