Search code examples
rubyazureazure-storageazure-sdk-for-ruby

Azure ruby sdk storage account create params, no method allow_blob_public_access


While doing a create on storage_accounts I get:

NoMethodError: undefined method allow_blob_public_access= for #Azure::Storage::Mgmt::V2019_06_01::Models::StorageAccountCreateParameter

This is the link to the StorageAccountCreateParameter on microsofts github.

My code looks like this:

sa_create_params = StorageModels::StorageAccountCreateParameters.new.tap do |sacp|
  sacp.kind = 'StorageV2'
  sacp.kind = payload['StorageAccountType'] if payload && payload['StorageAccountType']
  sacp.sku = sku
  sacp.location = params['region']
  sacp.access_tier = 'hot'
  sacp.access_tier = payload['AccessTier'] if payload && payload['AccessTier']
  sacp.tags = system_tags(params)
  sacp.allow_blob_public_access = false
end

Without the last line, regarding public access, it works just fine. I've tried upversioning the gems (hence the current version). And looking at their github it looks pretty self-explanatory. I'm at a loss, all help is much appreciated.

I'm using the following gems: ms_rest_azure 0.11.0 azure_mgmt_storage 0.21.0

Update: it seems the name should be sacp.properties.allow_blob_public_acces as per link. But this also throws a NoMethodError


Solution

  • I updated all azure gems to the latest version. Relevant gems:

    spec.add_dependency 'ms_rest_azure', '~> 0.12.0'
    Spec.add_dependency 'azure_mgmt_storage', '~> 0.22.0'
    

    This did the trick