Elastic job deployed by ARM Template fails with error 'Bad Length.'

Dean Nicholson 1 Reputation point
2021-03-29T21:25:38.26+00:00

I have an Elastic Job deployed via ARM Template that fails on step 1 with error 'Bad Length.' Google error and there are no hits. Job has 6 steps. Troubleshooting steps: Delete job and recreate via SQL and it runs fine. Deploy again by SDP and it fails on step 1 with same error. Execute sql code in Step 1 deployed by SDP from SSMS and it executes successfully. Retrieved sql code from jobs.jobsteps. Deleted step 1then started job and it failed on Step 1 (old step 2) with 'Bad Length.' re-added Step 1 as Step 1 via TSQL. Started the job and the Step 1 succeeded. Step 2 failed with 'Bad Length.' No entries in log analytics Not sure what to try next.

Azure SQL Database
{count} votes

3 answers

Sort by: Most helpful
  1. Dean Nicholson 1 Reputation point
    2021-04-02T15:38:26.41+00:00

    @AnuragSharma-MSFT 84067-elasticjobsdeploy.txt84121-elasticjobparametersdev.txtLet me know if I redacted too much.


  2. Anurag Sharma 17,616 Reputation points
    2021-04-07T09:15:02.087+00:00

    hi @Dean Nicholson , I was trying to run the templates but there were few configuration I was not able to sort out. Could you help me with below parameters?

    1. credentials_ElasticDbJob_SqlUsername
    2. credentials_CentralDataLoad_Sqlusername

    Are these scoped credentials? If yes, please tell me which databases are these created on and have we added any permissions here?

    0 comments No comments

  3. Dean Nicholson 1 Reputation point
    2021-04-16T17:40:52.317+00:00

    Hi @AnuragSharma-MSFT Sorry for not responding sooner

    1) Is the sql login/user that runs the elastic job
    2) is the same sql login that the target server job 'outputs' back to the CentralLoad database which happens to be the same db that holds the elastic job. I expect this to change in the future but is how it is currently set up. 1 sql account runs it all.

    in the elasticJobDB
    CREATE DATABASE SCOPED CREDENTIAL GroupEnumCred WITH IDENTITY = 'SqlAccount',
    SECRET = '';
    GO

    -- Create a database scoped credential for for Job execution
    CREATE DATABASE SCOPED CREDENTIAL JobExeccred WITH IDENTITY = 'SqlAccount',
    SECRET = '';
    GO
    --On ElasticJobDB Server
    CREATE LOGIN [SqlAccount]
    WITH
    PASSWORD = '';
    CREATE USER [SqlAccount]
    FOR LOGIN [SqlAccount];
    GO
    --on ElasticJobDB
    CREATE USER [SqlAccount]
    FOR LOGIN [SqlAccount];
    GO
    Create ROLE ElasticJobUser AUTHORIZATION dbo
    ALTER ROLE ElasticJobUser ADD MEMBER [SqlAccount]
    ALTER ROLE db_owner ADD MEMBER ElasticJobUser

    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.