decryption
1 TopicIssue with Encryption Keys
Hi! I am in the middle of separating Power BI Report Server portal to another machine (lets call id Machine2) from current server where it is running now (lets call it Machine1). I want to use the same SQL database from Machine1 because of not compete'ing for resources (mainly CPU) in this scenario. I have an issue with decrypting restored encryption keys and I can't overcome it. I've connected to my database, restore the encryption key (backed up previously on Machine1) and the portal is working fine. I can see all my folders/reports. The problem starts when I try to open Manage->Data Sources because it looks that sensitive information can't be encrypted. I get an error: and when clicking OK - the portal tries to redirect me to the wrong report link with "/browse/" instead of "/powerbi/" inside. In the RS Portal log file I get like below. Can someone help me with this? What could be the reason? My new portal is upgraded to Sep21 version. 2021-10-06 11:07:51.1782|ERROR|7|Decryption failed, Current user: (edited -my service account user)| RequestID = s_abf2472f-056a-4375-811e-41a787c25913 System.Security.Cryptography.CryptographicException: Bad Data. at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) at System.Security.Cryptography.Utils._DecryptData(SafeKeyHandle hKey, Byte[] data, Int32 ib, Int32 cb, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode PaddingMode, Boolean fDone) at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) at System.Security.Cryptography.CryptoStream.FlushFinalBlock() at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at Microsoft.BIServer.HostingEnvironment.Cryptography.SymmetricKeyCrypto.DecryptInternal(Byte[] data) 2021-10-06 11:07:51.2022|ERROR|7|OData exception occurred: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.BIServer.HostingEnvironment.Cryptography.Exceptions.CryptoException: Decryption Failure ---> System.Security.Cryptography.CryptographicException: Bad Data. at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) at System.Security.Cryptography.Utils._DecryptData(SafeKeyHandle hKey, Byte[] data, Int32 ib, Int32 cb, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode PaddingMode, Boolean fDone) at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) at System.Security.Cryptography.CryptoStream.FlushFinalBlock() at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at Microsoft.BIServer.HostingEnvironment.Cryptography.SymmetricKeyCrypto.DecryptInternal(Byte[] data) --- End of inner exception stack trace --- at Microsoft.BIServer.HostingEnvironment.Cryptography.SymmetricKeyCrypto.DecryptInternal(Byte[] data) at Microsoft.BIServer.HostingEnvironment.Cryptography.Crypto.Decrypt(Byte[] protectedData, String tag) at Microsoft.BIServer.HostingEnvironment.Cryptography.Crypto.DecryptToString(Byte[] protectedData) at Microsoft.ReportingServices.Portal.Services.ODataExtensions.DataModelDataSourceExtensions.ToDataSourceWithoutSecret(DataModelDataSourceEntity dataSourceEntity) at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Model.PowerBIReportRepository.LoadDataSources() at Model.PowerBIReport.get_DataSources() at lambda_method(Closure , PowerBIReportRepository ) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Delegate.DynamicInvokeImpl(Object[] args) at Microsoft.AspNet.OData.Query.Expressions.SelectExpandBinder.Bind(Object entity, SelectExpandQueryOption selectExpandQuery) at Microsoft.AspNet.OData.Query.ODataQueryOptions.ApplySelectExpand[T](T entity, ODataQuerySettings querySettings) at Microsoft.AspNet.OData.Query.ODataQueryOptions.ApplyTo(Object entity, ODataQuerySettings querySettings) at Microsoft.AspNet.OData.EnableQueryAttribute.ExecuteQuery(Object responseValue, IQueryable singleResultCollection, IWebApiActionDescriptor actionDescriptor, Func`2 modelFunction, IWebApiRequestMessage request, Func`2 createQueryOptionFunction) at Microsoft.AspNet.OData.EnableQueryAttribute.OnActionExecuted(Object responseValue, IQueryable singleResultCollection, IWebApiActionDescriptor actionDescriptor, IWebApiRequestMessage request, Func`2 modelFunction, Func`2 createQueryOptionFunction, Action`1 createResponseAction, Action`3 createErrorAction) at Microsoft.AspNet.OData.EnableQueryAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext) at System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext().| RequestID = s_abf2472f-056a-4375-811e-41a787c25913 Regards, Marcin2.4KViews0likes2Comments