Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Marcin_PL
Helper I
Helper I

Issue 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:

Marcin_PL_0-1633513355538.png

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,

Marcin

2 REPLIES 2
Icey
Community Support
Community Support

Hi @Marcin_PL ,

 


 

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).

 


How do you realize this requirement?

 

I try to reproduce it via:

 

1. Change the Report Server database on Machine2 to the same report server database on Machine1.

2. Change the Report Server database credential.

3. Restore the Encryption Keys with the backup file from Machine1.

 

Aret there any differences between our steps?

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Icey ,

 

thank you for your response. I believe I did it correctly. This issue was present when I try to connect to my test database from test environment server (Machine 3).

 

Fortunately, next day, when I tried to connect to the backup of my production database it worked without any problem. So we did a migration last Sunday and everything seems to be OK.

 

So this case is not so important to me now. However, it would be great to know how to solve this issue mentioned in my first post, because I believe that my both scenarios were the same.

 

Regards,

Marcin

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.