Changing K12 project's DB to Azure

Hosam Abdeltawab asked on September 18, 2020 19:12

I wanted to change our database's location from running locally on the SQLExpress server to Azure's SQL server.

The steps I followed were the following:

  1. From SSMS, I exported the DB using "Export Data-Tier Application" to generate a .bacpac file
  2. From SSMS, I disconnected from my local server and connected to Azure's SQL server
  3. I restored the .backpack file on the Azure server using SSMS import data-tier application
  4. Since the CMS DB has a user that is needed, I created the credentials on the Azure DB using the following queries

        -- ======================================================================================
        -- Create SQL Login template for Azure SQL Database and Azure SQL Data Warehouse Database
        -- ======================================================================================
        CREATE LOGIN <Username>
        WITH PASSWORD = 'StrongPassword'
        -- ========================================================================================
        -- Create User as DBO template for Azure SQL Database and Azure SQL Data Warehouse Database
        -- ========================================================================================
        -- For login <login_name, sysname, login_name>, create a user in the database
        CREATE USER <user_name>
            FOR LOGIN <login_name>
            WITH DEFAULT_SCHEMA = <dbo>
    • After the log-in was successfully created, I changed the connectionStrings in both my webApp project and my MVC project to point to Azure's server
    • I re-built and ran both projects (Projects are running on IIS and the DB is running on Azure)

The issue that I am having is that when I try to go to the admin portal -> pages and select one of my pages, it gives me "Exception of type 'System.Web.HttpUnhandledException' was thrown." error, and when I try to navigate to the selected page through the browser, I get an "Invalid Object Name" exception.

The invalid object name is my page name, I checked the DB table data on Azure's SQL server and the data is there. I don't know if there is an extra step that I should do or if it is not seeing the data due to some permissions issue.

Can someone help shed some light on this?

Correct Answer

Brenden Kehren answered on September 19, 2020 14:50

Does your db user have db owner privilege?

1 votesVote for this answer Unmark Correct answer

Recent Answers

Hosam Abdeltawab answered on September 20, 2020 22:17

yes, I changed that to dbo instead of db_owner and it worked.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.