locked
ASP.NET Membership Provider RRS feed

  • Question

  • Ok, so this is probably a dumb question, but I'll ask it anyway.  How do I setup a membership user up in the hosted azure?  Obviously, I can do it in code, but I want really want to upload any code  to create an "application admin"  I'd like to somehow have that user created once.  I have done this with local databases and hosted apps by creating the users locally and then moving the entire db over to the hosted environment or connecting directly to the database and creating a user that way.  Am I missing something here about directly creating a user?  Have I missed something in a read me file somewhere?  Any info is appreciated.

    Wally

    MVP in ASP.NET - ASPInsider - Author
    Wednesday, December 31, 2008 4:40 AM

Answers

  • Hi Wally,

    the ASP providers that are included as samples in the SDK expose the complete API (with only small semantic changes) of the standard SQL providers. The difference is that they use the Windows Azure Storage Services to store provider data.

    There are three ways to solve your problem:

    (1) The Windows Azure SDK comes with the AspProviderDemo sample. Go to the sample and configure the ServiceConfiguration.cscfg file in the sample so that it uses your storage account. For example, configure the account name to your storage account name and use https://blob.core.windows.net and https://table.core.windows.net as the storage endpoints and set the allowInsecureRemoteEndpoint setting to false (standard).  You can also use a http endpoint and set the allowInsecureRemoteEndpoint setting to true if security issues are not so important for you. Now run the app in the local development fabric (F5 in VS). There is a create user wizard in the app that you can use to create your users in your storage account and your membership tables. When you run your own Web site with Windows Azure you can then access the users because they are persisted in the storage services.

    (2) As the providers conform to the standard ASP.NET provider model, you can also make use of the standard ASP.NET configuration wizard in VS. In VS, go to solution explorer and select your Web role. In the top of the Solution explorer, a new icon appears for the configuration wizard. Click the icon, in the Web site that comes up click on security and you can create your users and roles. The problem is that this wizard will read the configuration from your Web.config file. Hence, all provider configuration must be available in the Web.config file -- the providers in the SDK can be configured in Web.config files and the cscfg files. The cscfg files are not considered by the wizard. I thus recommend using the above solution (1).

    (3) If you want you can write a small Windows Azure service that uses the providers included as sample in the SDK and create the users from within this app. For this to work, you configure the providers to access the real storage servies (table.core.windows.net etc.) and run the application in the local simulation environment. Use the Membership.CreateUser method to create the users or even easier use a predefined create user wizard such as the AspProvidersDemo sample does.

    The easiest way for you seems to be solution (1).
    Saturday, January 3, 2009 12:03 AM

All replies

  • I think I'm missing something, but can't you just connect from your local machine to the cloud to initialize the users in your table?

    Wednesday, December 31, 2008 5:36 AM
  • You are going down the correct path thinking about a membership system.  That said, you won't be able to use a Windows, Active Directory, or SQL membership provider as the underlying storage for each of those will not work in Azure.  To use a membership provider for Azure, you will need a provider that is based either in Azure table storage or in SQL Data Services storage.  I use SQL Data Services as I have the rest of our data model ported to SQL Data Services and want to keep the same application management.  The Azure SDK includes some sample providers for you.  As far as the problem getting in the first user, you can do that with a user creation wizard or you can initialize the data in your underlying store.  Again, I use SQL Data Services, so I can simply connect to the service from my office and create a new user object in the cloud storage.

    There are a number of examples of providers out there for your use.  Here are a couple of links:
    http://dotnetslackers.com/articles/aspnet/Azure-Cloudship-Membership-Provider-for-the-Cloud.aspx
    http://msdn.microsoft.com/en-us/library/dd179406.aspx

    Good luck,
    Shan McArthur
    www.shanmcarthur.net
    Wednesday, December 31, 2008 3:27 PM
  • Aleks,

    I can connect to the local cloud, but what about the cloud at Microsoft's data center?
    MVP in ASP.NET - ASPInsider - Author
    Wednesday, December 31, 2008 9:03 PM
  • Shan,

    I'm looking at the providers included with the azure hands on labs.
    MVP in ASP.NET - ASPInsider - Author
    Wednesday, December 31, 2008 9:05 PM
  • Shan,

    Yeah, I'm trying to figure out how to create the first user and I was hoping to not put that into my asp.net app start event in gloval.asax.  Any suggestions are appreciated.

    Wally

    MVP in ASP.NET - ASPInsider - Author
    Wednesday, December 31, 2008 9:19 PM
  •  You can write a simple tool using StorageClient (the sample that ships with the SDK) to insert into your cloud. The <acct>.table.core.windows.net endpoint is accessible from both cloudapp.net and anywhere else on the internet. So you can just do the insertions manually into the table.
    Wednesday, December 31, 2008 11:17 PM
  • Hi Wally,

    the ASP providers that are included as samples in the SDK expose the complete API (with only small semantic changes) of the standard SQL providers. The difference is that they use the Windows Azure Storage Services to store provider data.

    There are three ways to solve your problem:

    (1) The Windows Azure SDK comes with the AspProviderDemo sample. Go to the sample and configure the ServiceConfiguration.cscfg file in the sample so that it uses your storage account. For example, configure the account name to your storage account name and use https://blob.core.windows.net and https://table.core.windows.net as the storage endpoints and set the allowInsecureRemoteEndpoint setting to false (standard).  You can also use a http endpoint and set the allowInsecureRemoteEndpoint setting to true if security issues are not so important for you. Now run the app in the local development fabric (F5 in VS). There is a create user wizard in the app that you can use to create your users in your storage account and your membership tables. When you run your own Web site with Windows Azure you can then access the users because they are persisted in the storage services.

    (2) As the providers conform to the standard ASP.NET provider model, you can also make use of the standard ASP.NET configuration wizard in VS. In VS, go to solution explorer and select your Web role. In the top of the Solution explorer, a new icon appears for the configuration wizard. Click the icon, in the Web site that comes up click on security and you can create your users and roles. The problem is that this wizard will read the configuration from your Web.config file. Hence, all provider configuration must be available in the Web.config file -- the providers in the SDK can be configured in Web.config files and the cscfg files. The cscfg files are not considered by the wizard. I thus recommend using the above solution (1).

    (3) If you want you can write a small Windows Azure service that uses the providers included as sample in the SDK and create the users from within this app. For this to work, you configure the providers to access the real storage servies (table.core.windows.net etc.) and run the application in the local simulation environment. Use the Membership.CreateUser method to create the users or even easier use a predefined create user wizard such as the AspProvidersDemo sample does.

    The easiest way for you seems to be solution (1).
    Saturday, January 3, 2009 12:03 AM
  • Thanks Frank.  I'll be looking into this a little more now.

    Wally


    MVP in ASP.NET - ASPInsider - Author
    • Proposed as answer by Hakan Egeli Monday, July 22, 2013 1:47 AM
    Sunday, January 4, 2009 3:30 AM
  • v1.2 of the Azure SDK does not include the AspProviderDemo. Please update this blog so we might find the proper demo.
    Monday, August 30, 2010 3:46 PM
  • Azure samples, including the Asp Provider Demo, are here.
    Monday, August 30, 2010 4:03 PM
    Answerer
  • I don't see any Provider Sample Projects anymore....

    This seems quite strange... was there a bug? did they break with the SDK changes?

     


    www.unravelled.info
    Thursday, June 23, 2011 6:18 AM
  • The Provider samples are available in the Windows Azure Platform Training Kit. I believe it is in the Assets folder for Building ASP.NET Applications with Windows Azure.
    Thursday, June 23, 2011 7:43 AM
    Answerer
  • You should check out my http://azureproviders.codeplex.com/  project, its a complete ASP.NET solution that uses the Azure Table Storage and Azure Blob storage as a data source for a custom Membership, Role, Profile, an Session-State providers. Developed in C# on the .NET 4 framework using Azure SDK V1.4. 
    Thursday, August 18, 2011 6:49 PM
  • Hey Wally,

    You might also want to take a peek at the ASP.NET Universal Providers. Currently in Beta, these will prove to be the officially supported version of the Windows Azure Samples Membership Providers.

    I featured this Nuget package amongst others on my Must have Nuget Packages for Windows Azure Development Post.


    Cory Fowler Windows Azure MVP http://blog.syntaxc4.net
    Thursday, August 18, 2011 11:37 PM
    Answerer