web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Error Importing database into dev (powershell)

(1) ShareShare
ReportReport
Posted on by
Hi I'm grabbing the last production database and importing it into my dev environment.  And I get this error:
 
Invoke-sqlcmd : 'axmrruntimeuser' is not a valid login or you do not have permission.User or role 'axmrruntimeuser' does not exist in this database.User or role 'axmrruntimeuser' does not exist in this database.
 
I took a look at the login section of SQL Server and this user does not exist.
 
 
Is it needed?
 
 
Can I just remove it from my script? 
 
 
Thanks
I have the same question (0)
  • Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at
    How are you importing the DB? I'm surprised to see Invoke-SqlCmd in the error message.
  • CU01050835-0 Profile Picture
    on at
     
     
    Through a power shell script.  Do you know the function of this user:
     
    'axmrruntimeuser'
     
    Can we do without it?
     
  • CU01050835-0 Profile Picture
    on at
    Through a powershell script.
  • Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at
    Yes, I know it's Powershell - it's in the thread title. But I have no idea what your script does. Unfortunately, I can't comment on your code there if you give us no information about it.
    The standard process does include creation of axmrruntimeuser , but we can't to review whether your script does this and other steps correctly.
    axmrruntimeuser is used for financial reporting.
  • CU01050835-0 Profile Picture
    on at
    Sorry about that, here's the code.  The problem seems to be that the 'axmrruntimeuser' is not in the SQL Server login section, so it cannot be added as a user to the database.  Perhaps it is being mistakenly removed when the database is exported to LCS.
     
    $ConnectionString = "Server=$server; Initial Catalog =$BackupName;TrustServerCertificate=True;Integrated Security=True"
    
    Invoke-sqlcmd  -ConnectionString $ConnectionString  -ErrorAction Continue -Query "
    CREATE USER axdeployuser FROM LOGIN axdeployuser
    EXEC sp_addrolemember 'db_owner', 'axdeployuser'
    
    CREATE USER axdbadmin FROM LOGIN axdbadmin
    EXEC sp_addrolemember 'db_owner', 'axdbadmin'
    
    CREATE USER axmrruntimeuser FROM LOGIN axmrruntimeuser
    EXEC sp_addrolemember 'db_datareader', 'axmrruntimeuser'
    EXEC sp_addrolemember 'db_datawriter', 'axmrruntimeuser'
    
    
    CREATE USER axretaildatasyncuser FROM LOGIN axretaildatasyncuser
    EXEC sp_addrolemember 'DataSyncUsersRole', 'axretaildatasyncuser'
    
    CREATE USER axretailruntimeuser FROM LOGIN axretailruntimeuser
    EXEC sp_addrolemember 'UsersRole', 'axretailruntimeuser'
    EXEC sp_addrolemember 'ReportUsersRole', 'axretailruntimeuser'
    
    CREATE USER axdeployextuser FROM LOGIN axdeployextuser
    EXEC sp_addrolemember 'DeployExtensibilityRole', 'axdeployextuser'
    
    CREATE USER [NT AUTHORITY\NETWORK SERVICE] FROM LOGIN [NT AUTHORITY\NETWORK SERVICE]
    EXEC sp_addrolemember 'db_owner', 'NT AUTHORITY\NETWORK SERVICE'
    
    UPDATE T1
    SET T1.storageproviderid = 0
        , T1.accessinformation = ''
        , T1.modifiedby = 'Admin'
        , T1.modifieddatetime = getdate()
    FROM docuvalue T1
    WHERE T1.storageproviderid = 1 --Azure storage
    
    ALTER DATABASE [$BackupName] SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 6 DAYS, AUTO_CLEANUP = ON)
    GO
    DROP PROCEDURE IF EXISTS SP_ConfigureTablesForChangeTracking
    DROP PROCEDURE IF EXISTS SP_ConfigureTablesForChangeTracking_V2
    GO
    -- Begin Refresh Retail FullText Catalogs
    DECLARE @RFTXNAME NVARCHAR(MAX);
    DECLARE @RFTXSQL NVARCHAR(MAX);
    DECLARE retail_ftx CURSOR FOR
    SELECT OBJECT_SCHEMA_NAME(object_id) + '.' + OBJECT_NAME(object_id) fullname FROM SYS.FULLTEXT_INDEXES
    	WHERE FULLTEXT_CATALOG_ID = (SELECT TOP 1 FULLTEXT_CATALOG_ID FROM SYS.FULLTEXT_CATALOGS WHERE NAME = 'COMMERCEFULLTEXTCATALOG');
    OPEN retail_ftx;
    FETCH NEXT FROM retail_ftx INTO @RFTXNAME;
    
    BEGIN TRY
    	WHILE @@FETCH_STATUS = 0  
    	BEGIN  
    		PRINT 'Refreshing Full Text Index ' + @RFTXNAME;
    		EXEC SP_FULLTEXT_TABLE @RFTXNAME, 'activate';
    		SET @RFTXSQL = 'ALTER FULLTEXT INDEX ON ' + @RFTXNAME + ' START FULL POPULATION';
    		EXEC SP_EXECUTESQL @RFTXSQL;
    		FETCH NEXT FROM retail_ftx INTO @RFTXNAME;
    	END
    END TRY
    BEGIN CATCH
    	PRINT error_message()
    END CATCH
    
    CLOSE retail_ftx;  
    DEALLOCATE retail_ftx; 
    -- End Refresh Retail FullText Catalogs"
     
  • CU01050835-0 Profile Picture
    on at
    hold on, you asked me how I'm importing the database, didn't you?  Sorry, (a little tired), I'll get to that..thx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 663 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 540 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 348 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans