AZURE : SQL Database : Creating a table from .net code - c#

Is it possible to create a Azure SQL database table employing code written within Visual Studio?
I have made attempts by creating an API on my mobile service and then calling that but each time I run into permission failures.
If I create the table directly from within Azure then my CRUD code works fine. However I need to provide users with the ability to create tables without them having to access Azure accounts.

I think you should try DbInitializer and Migrations in your .NET backend of Windows Azure Mobile Service.
In the attached link described how it works.
http://blogs.msdn.com/b/writingdata_services/archive/2014/03/28/mobile-services-net-backend-initializers-and-model-updates.aspx

Related

Xamarin - Set Up Azure Offline Sync in C#

I have watched this tutorial on setting up offline sync for a Xamarin application using an Azure backend. I have a MySQL table on my Azure portal and I now wish to add the back-end calls to sync my local SQLite database with the MySQL cloud database.
I am not using the Easy Tables software used in the tutorial above, and I would like to use C# for the backend calls for my MobileServiceClient to talk to, where it calls methods such as:
await client.SyncContext.PushAsync();
await table.PullAsync("alltable", table.CreateQuery());
await table.InsertAsync(entry);
What are the steps to setting up the cloud syncing functionality from my SQLite store to my MySQL database?
Unfortunately MySQL is not compatible with Azure's IMobileServiceClient, you must change to using Azure SQL to use the inbuilt functions in IMobileServiceClient

Is it bad practice to create the AdalTokenCache as an SQL Database in Azure?

My MVC web application uses Azure AD Authentication. Initially when you run the wizard on your project to set this up for you it creates an mdf database file in your project for the AdalTokenCache. This isn't compatible with Azure as you can't use local MDF files.
What I have done is created the AdalTokenCache as a database in my Azure portal and I'm using that instead (which works fine). My question is, is this bad practice and if so what's the best way of handling it?

Automatic azure deployment

We've developed a MVC application that uses a SQL database to store data. We chose the approach to have a separate web app in azure (customer.ourdomain.com) per customer, as well as a separate database per customer running on our SQL server. This database is pointed to by the MVC application in the web.config file.
I've also created a website where new customers can register to use / try our product. Now every time somebody registers for our product I want the following to happen:
Create an Azure web app with the name of the company / customer that registers
Create a new database including the tables and relationships that our application needs
Publish the stable release of our application to the web app in azure and configure the application to use the newly created database
I've managed to do the first step using Azure ARM templates and the second step using dacpac and the Azure API, but I don't know how to use TFS (or any other method) to publish a stable release and change the connection strings before publishing the application to the azure app. (I've not even managed to publish anything with C# code).
Is the approach I'm taking in general okay or should I take a different approach? What is the best way to publish a stable release to the web app and most importantly, change the connection string so the published version will connect to the new database?
If you get vsts to package up your stable release and upload it to blob storage, you can reference that web app as part of the ARM template deployment, ie. include the web app code deployment along with the web app service itself.
This page shows how it can be done. I think you can also get the web app and ARM template to pull a release from vsts (I'm pretty confident you can do it via GitHub) using the app service's source control integration/CD settings as well, but cant find any details on this.

Can i use my own database in Azure mobile services for Windows Phone 8.1 apps?

When creating a new service for my Windows Phone 8.1 database is also created for that service.
Instead of using service created database, can I use my own database which is located in webhost4life.com? Can I use this database, located on that server, for data adding.
By default, whenever you create a mobile service, you're required to specify a SQL database as well. You do not need to use this database. You can connect to any database you want to, from your mobile service backend code, and do whatever you want.
Just note that might need to create custom API calls, rather than the built-in CRUD operations, since the CRUD operations take advantage of a table class derivative that takes care of a lot of ORM-based things for you. If you plan on bypassing all of that, then the custom API route will let you do that.
Yes you absolutely can ! Check out this blog post on how to connect mobile services to a MongoDB backend. You just need to overwrite the backend scriptlets to handle the CRUD operations http://blogs.msdn.com/b/azuremobile/archive/2014/04/14/creating-mongodb-backed-tables-in-azure-mobile-services-with-net-backend.aspx
When you create a mobile service,a SQL database is required by default. But Microsoft Azure also provide options to make it easy to take advantage of existing assests in building a mobile service. Supported assets include any resource that runs on a static TCP port, including Microsoft SQL Server, MySQL, HTTP Web APIs, and most custom web services.
See details at https://azure.microsoft.com/zh-cn/documentation/articles/mobile-services-dotnet-backend-use-existing-sql-database/ and https://azure.microsoft.com/zh-cn/documentation/articles/mobile-services-dotnet-backend-hybrid-connections-get-started/

Connecting asp.net Identity to SQL Azure

It seems MVC 5 no longer uses simple membership and I am having trouble figuring out how to use a SQL Azure database instead of the default .mdf file that is generated and saved on the web server. In simple membership it was as easy as changing two connection strings but that does not seem to be the case here. From what I have found online, it seems like I have to create my own custom storage provider to accomplish such a simple task. The only examples and docs I find online that deal with Azure are scenarios in which the developer wants to store in a non-relational setup or Azure Table storage.
Am I right in the above conclusion or is there something I am missing about integrating SQL Azure DB into my MVC 5 Asp.Net Identity app?
I have Identity running on top of a SQL Azure DB in one of my projects. You don't need to implement your own storage provider. The only thing you have to do is to change the connection string (normally named DefaultConnection) in your web.config file and point it to your SQL Azure DB.

Categories

Resources