Azure.jl icon indicating copy to clipboard operation
Azure.jl copied to clipboard

UndefVarError: `StorageAccountsApi` not defined

Open atemmo opened this issue 2 years ago • 2 comments

I get an error trying to use any of the functions related to blob storage, for example using the README example (it doesn't get as far as actually trying to login, also tested with working credentials/parameters):

using Azure
using OpenAPI
using Azure.StorageManagementClient
using Azure.StorageServices
using Azure.ComputeManagementClient
using Azure.UsageManagementClient

creds = AzureCredentials("tenantid-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
                         "appidxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
                         "password-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
ctx = AzureContext(creds)

const subscription_id = "subscrip-tion-idxx-xxxx-xxxxxxxxxxxx"
const resource_group_name = "testresgroup"

const storageaccount_url = "https://mystorage.blob.core.windows.net/"
const testcontainer = storageaccount_url * "testcontainer1"

listContainers(ctx, subscription_id, resource_group_name, storageaccount_url)

produces the following error:

ERROR: UndefVarError: `StorageAccountsApi` not defined
Stacktrace:
 [1] extract_account_and_key(ctx::AzureContext, subscription_id::String, resource_group_name::String, uri::String)
   @ Azure.StorageServices ~/.julia/packages/Azure/cABP5/src/StorageServices/common.jl:30
 [2] resource_op(ctx::AzureContext, op::String, subscription_id::String, resource_group_name::String, uri::String, accountkey::Nothing, headers::Dict{Symbol, String}, data::Nothing; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Azure.StorageServices ~/.julia/packages/Azure/cABP5/src/StorageServices/common.jl:19
 [3] resource_op (repeats 2 times)
   @ ~/.julia/packages/Azure/cABP5/src/StorageServices/common.jl:17 [inlined]
 [4] #getResource#3
   @ ~/.julia/packages/Azure/cABP5/src/StorageServices/common.jl:10 [inlined]
 [5] getResource (repeats 2 times)
   @ ~/.julia/packages/Azure/cABP5/src/StorageServices/common.jl:9 [inlined]
 [6] listContainers(ctx::AzureContext, subscription_id::String, resource_group_name::String, uri::String, accountkey::Nothing; prefix::Nothing, marker::Nothing, maxresults::Nothing, includemetadata::Bool, timeout::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Azure.StorageServices ~/.julia/packages/Azure/cABP5/src/StorageServices/blob.jl:16
 [7] listContainers
   @ ~/.julia/packages/Azure/cABP5/src/StorageServices/blob.jl:13 [inlined]
 [8] listContainers(ctx::AzureContext, subscription_id::String, resource_group_name::String, uri::String)
   @ Azure.StorageServices ~/.julia/packages/Azure/cABP5/src/StorageServices/blob.jl:13
 [9] top-level scope
   @ ~/Documents/git.nosync/testing/src/testing.jl:23

This is with fresh julia 1.8.5/1.9 installation with only Azure.jl installed. As far as I can tell StorageAccountsAPI is not exported by Azure.StorageManagementClient and is not available for StorageServices. But maybe I am missing something.

atemmo avatar May 23 '23 14:05 atemmo

Hello,

I face exactly the same issue (Azure.jl V0.5 and Julia 1.9) and do not find any solution or workaround). Any advice? The same piece of code used to work (prior Julia version).

juliencraftai avatar Oct 06 '23 12:10 juliencraftai

personally I switched to AzStorage.jl.

atemmo avatar Oct 06 '23 16:10 atemmo