/// <summary> /// Generates an embed token for multiple reports, datasets and target /// workspaces. Reports and datasets do not have to be related. The binding of /// a report to a dataset can be done during embedding. Target workspaces are /// workspaces where creation of reports is allowed.<br/>This API is /// relevant only to ['App owns data' embed /// scenario](https://docs.microsoft.com/power-bi/developer/embed-sample-for-customers). /// </summary> /// <remarks> /// <br/>**Required scope**: <ul><li>Content.Create - /// required only if a target workspace is specified in /// [GenerateTokenRequestV2](/rest/api/power-bi/embedtoken/generatetoken#generatetokenrequestv2)</li><li>Report.ReadWrite.All /// or Report.Read.All - required only if a report is specified in /// [GenerateTokenRequestV2](/rest/api/power-bi/embedtoken/generatetoken#generatetokenrequestv2)</li><li>Report.ReadWrite.All /// - required if allowEdit flag is specified for at least one report in /// [GenerateTokenRequestV2](/rest/api/power-bi/embedtoken/generatetoken#generatetokenrequestv2)</li><li>Dataset.ReadWrite.All /// or Dataset.Read.All</li></ul>To set the permissions scope, see /// [Register an /// app](https://docs.microsoft.com/power-bi/developer/register-app).</br></br>When /// using service principal for authentication, refer to [Service Principal /// with Power /// BI](https://docs.microsoft.com/power-bi/developer/embed-service-principal) /// document along with considerations and limitations section. /// <h2>Restrictions</h2><li>All the reports and datasets /// must reside in workspace V2. All the target workpaces must be workspace /// V2.</li><li>Maximum number of reports, datasets and target /// workspaces is 50 each.</li><li>Generating Embed Token with RLS /// may not work for AS Azure or AS OnPrem live connection reports for several /// minutes after a /// [Rebind](/rest/api/power-bi/reports/RebindReport).</li><br/> /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='requestParameters'> /// Generate token parameters /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <EmbedToken> GenerateTokenAsync(this IEmbedTokenOperations operations, GenerateTokenRequestV2 requestParameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GenerateTokenWithHttpMessagesAsync(requestParameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { Datasets = new DatasetsOperations(this); Users = new Users(this); Imports = new ImportsOperations(this); Reports = new ReportsOperations(this); Dashboards = new DashboardsOperations(this); Tiles = new TilesOperations(this); Apps = new AppsOperations(this); Dataflows = new DataflowsOperations(this); Gateways = new GatewaysOperations(this); Groups = new GroupsOperations(this); Capacities = new CapacitiesOperations(this); AvailableFeatures = new AvailableFeaturesOperations(this); DataflowStorageAccounts = new DataflowStorageAccountsOperations(this); Admin = new Admin(this); EmbedToken = new EmbedTokenOperations(this); BaseUri = new System.Uri("https://api.powerbi.com"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
/// <summary> /// Generates an embed token for multiple reports, datasets and target /// workspaces. Reports and datasets do not have to be related. The binding of /// a report to a dataset can be done during embedding. Target workspaces are /// workspaces where creation of reports is allowed.<br/>This API is /// relevant only to ['App owns data' embed /// scenario](https://docs.microsoft.com/power-bi/developer/embed-sample-for-customers). /// </summary> /// <remarks> /// <br/>**Required scope**: <ul><li>Content.Create - /// required only if a target workspace is specified in /// [GenerateTokenRequestV2](/rest/api/power-bi/embedtoken/generatetoken#generatetokenrequestv2)</li><li>Report.ReadWrite.All /// or Report.Read.All - required only if a report is specified in /// [GenerateTokenRequestV2](/rest/api/power-bi/embedtoken/generatetoken#generatetokenrequestv2)</li><li>Report.ReadWrite.All /// - required if allowEdit flag is specified for at least one report in /// [GenerateTokenRequestV2](/rest/api/power-bi/embedtoken/generatetoken#generatetokenrequestv2)</li><li>Dataset.ReadWrite.All /// or Dataset.Read.All</li></ul>To set the permissions scope, see /// [Register an /// app](https://docs.microsoft.com/power-bi/developer/register-app).</br></br>When /// using service principal for authentication, refer to [Service Principal /// with Power /// BI](https://docs.microsoft.com/power-bi/developer/embed-service-principal) /// document along with considerations and limitations section. /// <h2>Restrictions</h2><li>All the reports and datasets /// must reside in workspace V2. All the target workpaces must be workspace /// V2.</li><li>Maximum number of reports, datasets and target /// workspaces is 50 each.</li><li>Generating Embed Token with RLS /// may not work for AS Azure or AS OnPrem live connection reports for several /// minutes after a /// [Rebind](/rest/api/power-bi/reports/RebindReport).</li><br/> /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='requestParameters'> /// Generate token parameters /// </param> public static EmbedToken GenerateToken(this IEmbedTokenOperations operations, GenerateTokenRequestV2 requestParameters) { return(operations.GenerateTokenAsync(requestParameters).GetAwaiter().GetResult()); }