< class="prominent-subhead ">

Unable to create or deploy K2 Cloud package with the following error: "Primary Credentials Not Authenticated. Session Not Authenticated"

This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.


K2 Cloud Update 11 FP08

When trying to create or deploy a K2 package on one of the environments the following error appears:

SourceCode.Hosting.Exceptions.AuthenticationException: Primary Credentials Not Authenticated. Session Not Authenticated. at SourceCode.Hosting.Client.BaseAPI.BaseAPIConnection.RemoteCall(String TypeName, String MethodName, Object[] Parameters, Boolean[] NullList, MarshalMessageType CallType) at SourceCode.Hosting.Client.BaseAPI.BaseAPI.RemoteCall(String TypeName, String MethodName, Object[] Parameters, Boolean[] NullList, MarshalMessageType CallType) at SourceCode.Deployment.Management.PackageDeploymentManager.ValidateUserRights() at SourceCode.Deployment.Standalone.UIManagerAction.ValidateUserRights(PackageDeploymentManager manager, String& sessionUsername) at SourceCode.Deployment.Standalone.UIManagerAction.ExecuteManagerAction(Action`2 action) at SourceCode.Deployment.Standalone.UIManagerAction.CreatePackage() at SourceCode.Deployment.Standalone.Launcher.<>c.b__7_0(UIManagerAction action) at SourceCode.Deployment.Standalone.Launcher.ExecuteButtonAction(Action`1 action)


- Following through the steps described in the Remote P&D Tool not prompting for login: "Primary Credentials Not Authenticated" KB article does not resolve this issue and after removing the account the issue still persists.

- Running P&D from different machines and with different user accounts does not help either. 


This problem can be caused by an expired K2 service account admin/app token. Renew the expired admin/app token for the K2 service account by means of re-running SharePoint App Registration using an Azure Tenant Admin user account, to grant consent in the process.