fsprojects / AzureStorageTypeProvider

An F# Azure Type Provider which can be used to explore Blob, Table and Queue Azure Storage assets and easily apply CRUD operations on them.
http://fsprojects.github.io/AzureStorageTypeProvider/
The Unlicense
84 stars 34 forks source link

Error - Unable to validate connection string Visual Studio 2015 #92

Closed mrunks closed 7 years ago

mrunks commented 7 years ago

Description

While trying to use the type provider with Visual Studio 2015 and the most recent version of the Microsoft.WindowsAzure.Storage library from Nuget I receive the following error message:

The Type Provider ProviderImplementation.AzureTypeProvider' reported an error: Unable to validate connection string (The remove server returned an errror: (501) Not Implemented)

Repro steps

Please provide the steps required to reproduce the problem

  1. Add the TypeProvider through Nuget
  2. Try to use use the following setup.

type Azure = AzureTypeProvider<"account", "Key">

I receive the red "squiggly" lines with the error message above.

Expected behavior

I expect to be able to connect to the blob storage. If I use the C# examples coded in F# without the type provider, I can successfully access the blob storage.

Related information

isaacabraham commented 7 years ago

I hate to say this, but - works on my machine. I'm using Windows 10 and the latest TP from NuGet. I'm assuming that you're putting "real" credentials rather than "account" / "Key".

Can you try putting in a "full" connection string (rather than separate account and key) and see if that works?

mrunks commented 7 years ago

Here is the exact code I have that causes the problem:

open FSharp.Azure
open FSharp.Azure.StorageTypeProvider
open Microsoft.WindowsAzure.Storage

module AzureTest =

    type WQAzureOne = AzureTypeProvider<"DefaultEndpointsProtocol=https;AccountName=waterqualitystorage;AccountKey=pgg+jG4LcR37fgh8H96KeSwIvdDdz5yCvGtJnrwGfH3rqSef8cXgL8zg3BnLL3mtmaL1Kxeimv/kqx2IJZtuPQ==">

    type WQAzureTwo = AzureTypeProvider<"waterqualitystorage","pgg+jG4LcR37fgh8H96KeSwIvdDdz5yCvGtJnrwGfH3rqSef8cXgL8zg3BnLL3mtmaL1Kxeimv/kqx2IJZtuPQ==">

Can you try that key its a test key so I'm not worried about securing anything.

When I installed nuget package it indicated that it is targeting 4.6.1.

I am on windows 10 as well. .NET Framework 4.6.1 with target runtime F# 4.4.0.0

Maybe something else I am fundamentally doing wrong ?

mrunks commented 7 years ago

typeprovidererror

Here is a screen shot of my error.

isaacabraham commented 7 years ago

OK - thanks for this. I can now reproduce it; it occurs when testing the connection string here. If you call the following code, you'll get the same error: -

open Microsoft.WindowsAzure.Storage
let connectionString = @"DefaultEndpointsProtocol=https;AccountName=waterqualitystorage;AccountKey=pgg+jG4LcR37fgh8H96KeSwIvdDdz5yCvGtJnrwGfH3rqSef8cXgL8zg3BnLL3mtmaL1Kxeimv/kqx2IJZtuPQ==" 

CloudStorageAccount
    .Parse(connectionString)
    .CreateCloudTableClient()
    .ListTables()
    |> Seq.toArray

So whilst on the one hand this is not a TP issue per se, I'd like to understand why this is happening.

etc. etc.

mrunks commented 7 years ago

The account is listed with the following attributes:

Standard/Hot Read-access geo-redundant storage (RA-GRS) Allowed Protocols = (Https Only) Performance = Standard Deployment Model = Resource manager.

Does any of that help ?

isaacabraham commented 7 years ago

Afraid not - that looks completely normal. I'd actually suggest raising this on this MSDN Forum as it's happening with the standard Azure SDK - it's not a Type Provider issue. Don't mention the type provider in the issue - that'll just complicate matters :-)

isaacabraham commented 7 years ago

@mrunks did you get anywhere with this?

simax commented 7 years ago

Hey Isaac,

I'm getting the same issue on my Windows 10 box and on my MacBook Pro running macOSusing VS Code.

I can connect to my storage account using the Microsoft Storage Explorer with the account storage name and key.

I've tried the various different style connection strings that @mrunks tried, I even get the same problem using the DevelopmentStorage account (type Azure = AzureTypeProvider<"UseDevelopmentStorage=true">) on my Windows box.

I can access my DevelopmentStorage quite happily on windows using the Microsoft.WindowsAzure.Storage client DLL's but not using the type provider

I'm using version 1.7.0 of the type provider in all cases.

If you need any other info, just let me know.

isaacabraham commented 7 years ago

Hi

So again, the problem is caused because there's a single table which has something different about it that crashes the underlying .NET SDK e.g. for @mrunks it was this: -

CloudStorageAccount
    .Parse(connectionString)
    .CreateCloudTableClient()
    .ListTables()
    |> Seq.toArray

Note that this has nothing to do with the TP itself, it's outside of it. I don't know why it happens though. Can you repro the same error?

simax commented 7 years ago

Ah, my mistake. I see now that I didn't read all the comments properly. You have clearly previously stated that the fault lies outside the TP and yes I can indeed reproduce the error with the code snippet you provided in conjunction with my account name and key.

Odd, I wonder what the problem is. I'll post a question (w/out mentioning the TP) on the MSDN forum you mentioned and report back here if I get any response.

simax commented 7 years ago

After posting a question on stack overlow as to why I was receiving the error described above I received the following response.

http://stackoverflow.com/questions/41301785/azure-storage-account-connection

Turns out, all I needed to do was set my Storage account type to General Purpose as opposed to Blob Storage. Once I did that I'm able to access my storage account with the TP

mrunks commented 7 years ago

Once I realized it was outside of the Type Provider I moved on to other tasks. Glad you found a solution and thanks for posting it!

isaacabraham commented 7 years ago

Great to know. I do wonder if we can figure a way around that or to identify these storage accounts and not try to list tables.