Forum Discussion
Failed to update data model parameters - using new October update way to change connection string
Hello,
I am not using a list of values but just a default value. This parameter is used as connection string in the data source settings. I would like to programatically change the value via PowerShell , in order to modify the connection string during deployment to another environment. I have now more information about the error, this is what the report server logs shows: An item with the same key has already been added.
2021-01-07 16:17:57.8626|INFO|572|Received request POST /api/v2.0/PowerBIReports(Path='/TestReport')/DataModelParameters| RequestID = s_adfa12bb-a254-4bac-bdc9-41dd77cb36d7
2021-01-07 16:17:58.7062|ERROR|515|OData exception occurred: System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at Microsoft.ReportingServices.Portal.Repositories.CatalogItemRepository.SetDataModelDataSourcesTrusted(IPrincipal userPrincipal, Guid itemId, IEnumerable`1 dataSources, Boolean isOverwrite)
at Microsoft.ReportingServices.Portal.ODataWebApi.V2.Controllers.PowerBIReportsController.<PostDataModelParameters>d__33.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.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__1`1.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.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.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_adfa12bb-a254-4bac-bdc9-41dd77cb36d7