CREATE DATABASE SCOPED CREDENTIAL on APS database fails

Debasish Lala 0 Reputation points
2023-08-23T14:41:12.7+00:00

I have been trying to follow the instructions on this APS to Azure Synapse Migration - 5.DeployScriptsToSynapse video https://www.youtube.com/watch?v=oorsuHHs7Ls&list=PLTPqkIPx9Hx8-dxWWv9Wyup2RQMMa6lHx&index=9 but when trying to create a database scoped credential on an APS database using the command

-- Replace <storageaccountname> and <storageaccountkey> with actual values valid in your environment
CREATE DATABASE SCOPED CREDENTIAL AzureStorageCredential WITH IDENTITY = '<storageaccountname>',
    SECRET = '<storageaccountkey>';
GO

it fails with the error

"Incorrect syntax near 'AzureStorageCredential'.

Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon."

I think this could be due to the version of Microsoft Analytics Platform System which is Microsoft SQL Server 2012 - 10.0.8035.0 (X64) Feb 28 2017 15:33:36 Copyright (c) Microsoft Corporation Parallel Data Warehouse (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) as on the video it shows that it does work on the APS database there and on all online documentation that is the correct commnd.

Does anybody know a workaround to be able to create the database scoped credential or external data source on this version of APS please?

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,316 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,494 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Vinodh247 32,371 Reputation points MVP
    2023-08-24T05:29:07.36+00:00

    can you place this query into a new query tab(remove all other queries) and try? i tried from my database it does work! it has no restriction to APS or specific databases.

    0 comments No comments

  2. Debasish Lala 0 Reputation points
    2023-08-24T13:39:30.05+00:00

    Hi Vinod

    Thank for the reply. I had tried to execute the

    -- Replace <storageaccountname> and <storageaccountkey> with actual values valid in your environment
    CREATE DATABASE SCOPED CREDENTIAL AzureStorageCredential WITH IDENTITY = '<storageaccountname>',
        SECRET = '<storageaccountkey>';
    GO
    

    command in a new query but it did give the error

    "Incorrect syntax near 'AzureStorageCredential'.

    Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon."

    Like you said from what I can see and everything I've read it should be able to execute this on an APS database but it doesn't work on the ones on the APS server we have.

    I was wondering what version of APS you're using please as there are a couple of objects in some of the other **Migrate APS/PDW to Azure Synapse Analytics playlist **videos that were not there so I can only think it might be because the APS server is an older version?

    0 comments No comments

  3. Vinodh247 32,371 Reputation points MVP
    2023-08-27T09:45:03.66+00:00

    I meant you try to execute in a new window against another database, not against APS. Just run the below without any other text, not even the comments.

    CREATE DATABASE SCOPED CREDENTIAL AzureStorageCredential WITH IDENTITY = '<storageaccountname>', SECRET = '<storageaccountkey>';
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.