Azure-sdk-for-js: @azure/arm-privatedns: Argument of type 'TokenCredentialsBase' is not assignable to parameter of type 'ServiceClientCredentials'.

Created on 5 Aug 2020  路  4Comments  路  Source: Azure/azure-sdk-for-js

I am trying to use @azure/arm-privatedns to query and set private dns. I am logging in with @azure/ms-rest-nodeauth using Service principal id and I get Argument of type 'TokenCredentialsBase' is not assignable to parameter of type 'ServiceClientCredentials'.

import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { PrivateDnsManagementClient } from "@azure/arm-privatedns";
.....
 msRestNodeAuth.loginWithServicePrincipalSecretWithAuthResponse(clientId, secret, tenantId).then((authres) => {
 const dnsclient = new PrivateDnsManagementClient(authres.credentials, subscriptionId);
......
}

The versions from my package.json are:

  "dependencies": {
    "@azure/arm-privatedns": "^1.0.0",
    "@azure/ms-rest-nodeauth": "^3.0.5"
  },
  "devDependencies": {
    "@azure/functions": "^1.0.2-beta2",
    "typescript": "^3.3.3"
  }
Mgmt Network - DNS customer-reported needs-team-attention question

Most helpful comment

@qiaozha
Can you please re-generate the package using latest v4 of the code generator to fix the dependency issue?

Thanks for reporting @usvgmani

If your project is not using any other libraries for which you use @azure/ms-rest-nodeauth, then you can change the version to 2.0.5 which will be compatible with v1 of @azure/arm-privatedns

Once we have released v2 of @azure/arm-privatedns, you can go back to using v3 of @azure/ms-rest-nodeauth

All 4 comments

There seems to be version incompatibility used by @azure/arm-privatedns for @azure/ms-rest-js and the latest version @azure/ms-rest-nodeauth. What version of @azure/ms-rest-nodeauth should i use to make it compatible and work with @azure/arm-privatedns (^1.0.0)

@qiaozha
Can you please re-generate the package using latest v4 of the code generator to fix the dependency issue?

Thanks for reporting @usvgmani

If your project is not using any other libraries for which you use @azure/ms-rest-nodeauth, then you can change the version to 2.0.5 which will be compatible with v1 of @azure/arm-privatedns

Once we have released v2 of @azure/arm-privatedns, you can go back to using v3 of @azure/ms-rest-nodeauth

Hi @ramya-rao-a @usvgmani , I have released a new pkg of @azure/arm-privatedns
https://www.npmjs.com/package/@azure/arm-privatedns

Thanks @chenjianfei2017

@usvgmani, Please try the latest version of the @azure/arm-privatedns package.

Was this page helpful?
0 / 5 - 0 ratings