### Installer Bootstrap dans Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/adding-external-libraries Cette section fournit un exemple d'installation de Bootstrap à l'aide de npm. Il s'agit d'installer le package bootstrap et d'inclure l'instruction d'import dans le fichier .less du visuel. ```powershell npm install bootstrap --save ``` ```less @import (less) "node_modules/bootstrap/dist/css/bootstrap.css"; ``` -------------------------------- ### Installer la bibliothèque D3 dans Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/adding-external-libraries Cette section fournit un exemple d'installation de la bibliothèque D3 et du package @types/d3 à l'aide de npm dans le code d'un visuel Power BI. Ceci permet d'ajouter des typages pour obtenir Intellisense et la sécurité au moment de la compilation. ```powershell npm install d3@5 --save npm install @types/d3@5 --save ``` ```typescript import * as d3 from "d3"; ``` -------------------------------- ### Start a Power BI Visual using PowerShell Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/custom-visual-develop-tutorial-format-options This command initiates the development server for a Power BI custom visual. It requires the 'pbiviz' tool to be installed and typically run from the project's root directory. The output is a running local server that allows for live updates to the visual as code is changed. ```powershell pbiviz start ``` -------------------------------- ### Installation des Utilitaires SVG Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-svg_source=recommendations Commande pour installer le package powerbi-visuals-utils-svgutils. ```APIDOC ## Installation des Utilitaires SVG ### Description Pour installer le package, vous devez exécuter la commande suivante dans le répertoire contenant votre visuel actuel. ### Method Bash ### Endpoint N/A ### Parameters Pas de paramètres. ### Request Example ```bash npm install powerbi-visuals-utils-svgutils --save ``` ### Response Pas de réponse spécifique pour cette commande. ``` -------------------------------- ### Installer powerbi-visuals-utils-svgutils Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-svg_source=recommendations Commande pour installer le package npm powerbi-visuals-utils-svgutils. Cette commande doit être exécutée dans le répertoire racine de votre projet de visuel Power BI. ```bash npm install powerbi-visuals-utils-svgutils --save ``` -------------------------------- ### Installation Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-tooltip Install the powerbi-visuals-utils-tooltiputils package using npm. ```APIDOC ## npm install powerbi-visuals-utils-tooltiputils ### Description Installs the tooltip utilities package and adds it as a dependency to your project's `package.json` file. ### Method ```bash npm install ``` ### Endpoint N/A ### Parameters N/A ### Request Example ```bash npm install powerbi-visuals-utils-tooltiputils --save ``` ### Response N/A ``` -------------------------------- ### Usage Example: Local Storage API v2 Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/local-storage_source=recommendations&tabs=v1 An example demonstrating how to use the v2 Local Storage API to set and retrieve data, including checking the status first. ```APIDOC ## How to Use the Local Storage API v2 ### Description This example shows how to initialize and use the v2 local storage service to set and get data, ensuring the API is allowed before proceeding. ### Request Example (TypeScript) ```typescript import IVisualLocalStorageV2Service = powerbi.extensibility.IVisualLocalStorageV2Service; import StorageV2ResultInfo = powerbi.extensibility.StorageV2ResultInfo; import PrivilegeStatus = powerbi.PrivilegeStatus; export class Visual implements IVisual { // ... private updateCountName: string = 'updateCount'; private updateCount: number; private storageV2Service: IVisualLocalStorageV2Service; constructor(options: VisualConstructorOptions) { this.storageV2Service = options.host.storageV2Service; this.init(); } private async init() { try { let status: powerbi.PrivilegeStatus = await this.storageV2Service.status(); if (status === PrivilegeStatus.Allowed) { // Retrieve initial count const count = await this.storageV2Service.get(this.updateCountName); this.updateCount = count ? parseInt(count, 10) : 0; // Set initial count if it doesn't exist or is invalid if (isNaN(this.updateCount)) { this.updateCount = 0; await this.storageV2Service.set(this.updateCountName, this.updateCount.toString()); } } else { console.error('Local Storage API v2 is not allowed. Status:', status); this.updateCount = 0; // Default to 0 if not allowed } } catch (error) { console.error('Error initializing local storage:', error); this.updateCount = 0; // Default to 0 on error } } public update(options: VisualUpdateOptions) { // ... // Only update if storage is allowed if (this.storageV2Service) { this.storageV2Service.status().then(status => { if (status === PrivilegeStatus.Allowed) { this.updateCount++; this.storageV2Service.set(this.updateCountName, this.updateCount.toString()).catch(error => { console.error('Error setting update count:', error); }); } else { console.warn('Local Storage API v2 not allowed during update.'); } }).catch(error => { console.error('Error checking status during update:', error); }); } // ... } } ``` ### Response Example (Conceptual) * **Success**: The promises returned by `get`, `set`, `remove`, and `status` will resolve with appropriate values or `void` upon success. * **Error**: Promises will reject with an error object detailing the issue (e.g., network error, invalid key, permissions issue). ``` -------------------------------- ### Create Install Ticket API Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install_source=recommendations Details on how to create an install ticket, which is used when redirecting users to Power BI for app installation. This operation utilizes the `CreateInstallTicket` API. ```APIDOC ## Step 2: Create an Install Ticket ### Description Create an install ticket, which is used when you redirect your users to Power BI. The API used for this operation is the `CreateInstallTicket` API. ### Method POST ### Endpoint `/groups/{groupId}/apps/{appId}/installTicket` (This is a placeholder; the actual endpoint might differ based on the API documentation) ### Parameters #### Path Parameters - **groupId** (string) - Required - The ID of the group (workspace) where the template app resides. - **appId** (string) - Required - The ID of the template app. #### Query Parameters None #### Request Body None (This API typically doesn't require a request body for creating a ticket) ### Request Example ```json { "example": "No request body needed for this operation." } ``` ### Response #### Success Response (200) - **ticket** (string) - A unique ticket generated for the installation. #### Response Example ```json { "ticket": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } ``` ### Further Information - Refer to the official Power BI API documentation for the exact endpoint and request/response details: [Template Apps - CreateInstallTicket](/fr-fr/rest/api/power-bi/template-apps/create-install-ticket) ``` -------------------------------- ### Installer les packages React pour les boîtes de dialogue Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/create-display-dialog-box_source=recommendations Cet exemple de commande console montre comment installer les packages npm requis pour utiliser React et react-datepicker dans votre projet de visuel Power BI. Ces dépendances sont nécessaires pour le rendu côté client de l'interface utilisateur de la boîte de dialogue, permettant une expérience utilisateur riche et interactive. ```console npm i react-dom react react-datepicker ``` -------------------------------- ### DataViewUtils Installation Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-dataview Instructions on how to install the powerbi-visuals-utils-dataviewutils package using npm. ```APIDOC ## Installation To install the package, run the following command in the directory with your current custom visual: ```bash npm install powerbi-visuals-utils-dataviewutils --save ``` This command installs the package and adds a package to your `package.json` file as a dependency. ``` -------------------------------- ### URL d'installation d'application Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install-tutorial_source=recommendations Cette URL est utilisée pour installer une application Power BI. Elle nécessite des paramètres tels que appId, packageKey et ownerId. L'URL est similaire à l'exemple fourni. ```html https://app.powerbi.com/Redirect?action=InstallApp&appId=3c386...16bf71c67&packageKey=b2df4b...dLpHIUnum2pr6k&ownerId=72f9...1db47&buildVersion=5 ``` -------------------------------- ### Power BI Project File Structure Example Source: https://learn.microsoft.com/fr-fr/power-bi/developer/projects/projects-overview_source=recommendations An example of a typical Power BI project file structure, showing different report, semantic model, and configuration files within a project directory. ```md project/ ├── AdventureWorks-Sales.Report/ │ └── definition.pbir ├── AdventureWorks-Stocks.Report/ │ └── definition.pbir ├── AdventureWorks.SemanticModel/ │ └── definition.pbism ├── .gitignore └── AdventureWorks.pbip ``` -------------------------------- ### Installer Power BI Desktop sans assistance Source: https://learn.microsoft.com/fr-fr/power-bi/fundamentals/desktop-get-the-desktop_source=recommendations Utilisez les options de ligne de commande pour installer Power BI Desktop sans interaction de l'utilisateur. Ceci est utile pour les déploiements en masse dans les organisations. ```shell msiexec.exe "C:\Path\To\PowerBI.msi" -q ``` ```shell msiexec.exe "C:\Path\To\PowerBI.msi" -quiet ``` ```shell msiexec.exe "C:\Path\To\PowerBI.msi" -s ``` ```shell msiexec.exe "C:\Path\To\PowerBI.msi" -silent ``` -------------------------------- ### Node.js Dependency Installation and Configuration for Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/developer/embedded/embed-sample-for-customers_tabs=net-core This section covers the setup for a Node.js project for Power BI embedded applications. It includes instructions for installing necessary dependencies using npm and configuring authentication parameters within a config.json file for both Service Principal and Master User authentication methods. ```bash npm install ``` ```json { "config": { "authenticationMode": "ServicePrincipal", // or "MasterUser" "clientId": "YOUR_CLIENT_ID", "workspaceId": "YOUR_WORKSPACE_ID", "reportId": "YOUR_REPORT_ID", "pbiUsername": "YOUR_PBI_USERNAME", // Required for MasterUser "pbiPassword": "YOUR_PBI_PASSWORD", // Required for MasterUser "tenantId": "YOUR_TENANT_ID", // Required for ServicePrincipal "appSecret": "YOUR_APP_SECRET" // Required for ServicePrincipal } } ``` -------------------------------- ### Installer Power BI Chart Utilities avec npm Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-chart Commande pour installer le package powerbi-visuals-utils-chartutils dans le répertoire de votre projet visuel Power BI. Cela ajoute la bibliothèque à vos dépendances de projet. ```bash npm install powerbi-visuals-utils-chartutils --save ``` -------------------------------- ### Explain DAX Topic with Copilot Source: https://learn.microsoft.com/fr-fr/power-bi/transform-model/dax-query-copilot-create Get detailed explanations and examples of DAX functions or topics using Copilot. By asking a specific question about a DAX function, Copilot provides a brief description and an option to view a more detailed explanation with an example. ```text Expliquer à quoi sert SUMMARIZECOLUMNS ``` -------------------------------- ### TypeUtils Installation Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-type_source=recommendations Instructions on how to install the TypeUtils package using npm. ```APIDOC ## Installation To install the package, run the following command in the directory with your current custom visual: ```bash npm install powerbi-visuals-utils-typeutils --save ``` This command installs the package and adds it to your `package.json` file as a dependency. ``` -------------------------------- ### Create Install Ticket API Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install This section details how to use the CreateInstallTicket API to generate a ticket for installing a template app. ```APIDOC ## POST /api/CreateInstallTicket ### Description Creates an installation ticket used when redirecting users to Power BI for template app installation and configuration. ### Method POST ### Endpoint /api/CreateInstallTicket ### Parameters #### Request Body - **InstallDetails** (array) - Required - A list of template app installation details. - **AppId** (string) - Required - The ID of the template app. - **PackageKey** (string) - Required - The package key of the template app. - **OwnerTenantId** (string) - Required - The tenant ID of the app owner. - **Config** (object) - Optional - Configuration details for the template app. - **Configuration** (object) - Key-value pairs for configuration parameters. ### Request Example ```json { "InstallDetails": [ { "AppId": "your-app-id-guid", "PackageKey": "your-package-key", "OwnerTenantId": "your-owner-tenant-id-guid", "Config": { "Configuration": { "ParameterName1": "ParameterValue1", "ParameterName2": "ParameterValue2" } } } ] } ``` ### Response #### Success Response (200) - **Ticket** (string) - The generated installation ticket. #### Response Example ```json { "Ticket": "H4sI...AAA=" } ``` ``` -------------------------------- ### Redirect User to Power BI with Install Ticket (HTML Form) Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install_source=recommendations This HTML snippet shows a basic method for redirecting users to Power BI to complete a template app installation. It uses an auto-submitting form with a hidden input field for the install ticket, suitable for testing or simple integrations. ```html
``` -------------------------------- ### Définir la stratégie de locataire de passerelle avec PowerShell Source: https://learn.microsoft.com/fr-fr/power-bi/guidance/powerbi-implementation-planning-data-gateways_source=recommendations Utilisez l'applet de commande PowerShell Set-DataGatewayTenantPolicy pour gérer qui peut installer des passerelles personnelles dans votre locataire. Cette commande est essentielle pour renforcer la gouvernance et la sécurité en limitant les installations aux utilisateurs approuvés. ```powershell Set-DataGatewayTenantPolicy -GatewayInstallerUserIds "user1@example.com","user2@example.com" ``` -------------------------------- ### Installer les utilitaires pour info-bulles Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-tooltip_source=recommendations Installe le package powerbi-visuals-utils-tooltiputils et l'ajoute en tant que dépendance au fichier package.json. Nécessite npm et un environnement Node.js. ```bash npm install powerbi-visuals-utils-tooltiputils --save ``` -------------------------------- ### Azure CLI Example for Monitoring Resource Source: https://learn.microsoft.com/fr-fr/power-bi/developer/embedded/monitor-power-bi-embedded_source=recommendations This example demonstrates how to use the Azure CLI to monitor a specific Azure resource. It assumes you have the Azure CLI installed and are logged in. The command targets a resource and retrieves its monitoring data. ```bash az monitor diagnostic-settings list --resource ``` -------------------------------- ### Get Touch Start Event Name Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-tooltip This utility function returns the appropriate event name for the start of a touch gesture. This is important for cross-browser compatibility and handling touch interactions on various devices. ```TypeScript function touchStartEventName(): string ``` -------------------------------- ### POST /api/install Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install-tutorial_source=recommendations This endpoint is used to initiate the automated installation of a project. It requires a POST request to your Azure Function with a JSON body containing key-value pairs representing the desired parameter values. ```APIDOC ## POST /api/install ### Description Initiates the automated installation of a project by sending a POST request to an Azure Function. The request body should contain key-value pairs for parameter configuration. ### Method POST ### Endpoint /api/install ### Parameters #### Request Body - **key** (string) - Required - The name of the parameter. - **value** (string) - Required - The desired value for the parameter. ### Request Example ```json { "parameterName": "parameterValue" } ``` ### Response #### Success Response (200) Upon successful configuration, the browser should automatically redirect to the client's Power BI account, displaying the automated installation flow. #### Response Example (Redirection to Power BI account with installation status) ``` -------------------------------- ### Power BI Deep Link - Open Dashboard within App Example Source: https://learn.microsoft.com/fr-fr/power-bi/consumer/mobile/mobile-apps-deep-link-specific-location An example of a Power BI deep link to open a dashboard that is part of an application. This link includes 'action' as 'OpenDashboard', 'appId', 'dashboardObjectId', and 'ctid'. ```text https://app.powerbi.com/Redirect?action=OpenDashboard&appId=&dashboardObjectId=&ctid= ``` -------------------------------- ### Install pbiviz using npm Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/environment-setup_source=recommendations Installs the latest version of the pbiviz tool, which is used to compile Power BI visual source code. This command is executed in Windows PowerShell. Warnings during execution are generally safe and do not prevent installation. ```powershell npm i -g powerbi-visuals-tools@latest ``` -------------------------------- ### Installer les dépendances de test pour Power BI Visuals Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/unit-tests-introduction_source=recommendations Ajoutez ces bibliothèques à la section "devDependencies" de votre fichier package.json pour configurer l'environnement de test avec Karma et Jasmine. ```json "@types/d3": "5.7.2", "@types/d3-selection": "^1.0.0", "@types/jasmine": "^3.10.2", "@types/jasmine-jquery": "^1.5.34", "@types/jquery": "^3.5.8", "@types/karma": "^6.3.1", "@types/lodash-es": "^4.17.5", "coveralls": "^3.1.1", "d3": "5.12.0", "jasmine": "^3.10.0", "jasmine-core": "^3.10.1", "jasmine-jquery": "^2.1.1", "jquery": "^3.6.0", "karma": "^6.3.9", "karma-chrome-launcher": "^3.1.0" ``` -------------------------------- ### Power BI Deep Link - Open Report in Workspace Example Source: https://learn.microsoft.com/fr-fr/power-bi/consumer/mobile/mobile-apps-deep-link-specific-location An example of a Power BI deep link to open a report located in a workspace other than 'My Workspace'. This requires 'action' as 'OpenReport', 'reportObjectId', 'groupObjectId', and optionally 'reportPage'. ```text https://app.powerbi.com/Redirect?Action=OpenReport&reportObjectId=&groupObjectId=&reportPage=ReportSection ``` -------------------------------- ### Azure PowerShell Example for Monitoring Resource Source: https://learn.microsoft.com/fr-fr/power-bi/developer/embedded/monitor-power-bi-embedded_source=recommendations This example shows how to use Azure PowerShell cmdlets to retrieve diagnostic settings for an Azure resource. Ensure you have the Azure PowerShell module installed and are authenticated. The cmdlet retrieves a list of diagnostic settings configured for the specified resource. ```powershell Get-AzDiagnosticSetting -ResourceId "" ``` -------------------------------- ### Installer pbiviz Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/environment-setup Installe la dernière version de l'outil Power BI Visuals Tools globalement à l'aide de npm. Cet outil est utilisé pour compiler le code source des visuels Power BI. Assurez-vous que Node.js et npm sont installés avant d'exécuter cette commande. ```powershell npm i -g powerbi-visuals-tools@latest ``` -------------------------------- ### GET /refreshes Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/asynchronous-refresh_source=recommendations Retrieves a list of historical, current, and pending refresh operations. The response includes details such as requestId, refreshType, start and end times, and status. ```APIDOC ## GET /refreshes ### Description Use the GET verb on the /refreshes collection to list historical, current, and pending refresh operations. The response body includes details about each refresh operation. ### Method GET ### Endpoint /refreshes ### Parameters #### Query Parameters - **$top** (integer) - Optional - Limits the number of refresh operation entries returned in the history. Defaults to all available entries. ### Request Example ```http GET https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes?$top={$top} ``` ### Response #### Success Response (200) - **requestId** (string) - Identifier for the refresh request. - **refreshType** (string) - Indicates how the refresh was triggered (e.g., 'ViaEnhancedApi', 'Scheduled', 'OnDemand'). - **startTime** (string) - The date and time the refresh started. - **endTime** (string) - The date and time the refresh ended. - **status** (string) - The completion status of the refresh operation (e.g., 'Completed', 'Failed', 'Unknown', 'Disabled', 'Cancelled'). - **extendedStatus** (string) - Provides additional information to complement the 'status' property. #### Response Example ```json [ { "requestId": "ddddeeee-3333-ffff-4444-aaaa5555bbbb", "refreshType": "ViaEnhancedApi", "startTime": "2020-12-07T02:06:57.1838734Z", "endTime": "2020-12-07T02:07:00.4929675Z", "status": "Completed", "extendedStatus": "Completed" }, { "requestId": "474fc5a0-3d69-4c5d-adb4-8a846fa5580b", "startTime": "2020-12-07T01:05:54.157324Z", "refreshType": "ViaEnhancedApi", "status": "Unknown" }, { "requestId": "85a82498-2209-428c-b273-f87b3a1eb905", "refreshType": "ViaEnhancedApi", "startTime": "2020-12-07T01:05:54.157324Z", "status": "Unknown", "extendedStatus": "NotStarted" } ] ``` ### Notes - Power BI may drop requests if there are too many requests in a short period. Power BI performs one refresh, queues the next request, and drops all others. You cannot query the status of dropped requests. - In Azure Analysis Services, a completed status is 'succeeded'. Solutions migrating from Azure Analysis Services to Power BI may require adjustments. ``` -------------------------------- ### Example Power Query Best Practices (M Language) Source: https://learn.microsoft.com/fr-fr/power-bi/guidance/fabric-adoption-roadmap-mentoring-and-user-enablement_source=recommendations This example demonstrates best practices for Power Query steps, focusing on cleanliness, order, and efficiency. It touches upon the importance of Query Folding when interacting with data sources. ```M Language let Source = Sql.Database("server", "database"), SalesTable = Source{[Schema="dbo",Item="Sales"]}[Data], // Applied steps should be clean, ordered, and efficient // Example: FilteredRows = Table.SelectRows(SalesTable, each [OrderDate] >= #date(2023, 1, 1)), // Example: ExpandedColumns = Table.ExpandTableColumn(FilteredRows, "Product", {"ProductName"}, {"ProductName"}) // Query Folding should be leveraged where possible in SalesTable ``` -------------------------------- ### API REST Power BI pour la création de tickets d'installation Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install_source=recommendations Utilisez les API REST Power BI pour créer un ticket d'installation qui contient la configuration des paramètres propre à l'utilisateur. ```APIDOC ## POST /createInstallTicket ### Description Crée un ticket d'installation pour une application modèle Power BI avec des paramètres utilisateur spécifiques. ### Method POST ### Endpoint /createInstallTicket ### Parameters #### Request Body - **templateAppId** (string) - Required - L'ID de l'application modèle. - **userConfiguration** (object) - Required - La configuration spécifique à l'utilisateur pour l'installation. - **parameterValues** (object) - Required - Les valeurs des paramètres à configurer pour l'application modèle. - **parameterName** (string) - Required - Le nom du paramètre. - **value** (string) - Required - La valeur du paramètre. ### Request Example ```json { "templateAppId": "your_template_app_id", "userConfiguration": { "parameterValues": [ { "parameterName": "DataConnectionString", "value": "your_connection_string" } ] } } ``` ### Response #### Success Response (200) - **installTicket** (string) - Le ticket d'installation généré. #### Response Example ```json { "installTicket": "generated_install_ticket_string" } ``` ``` -------------------------------- ### Text Filters with IN Operator in Power BI Expressions Source: https://learn.microsoft.com/fr-fr/power-bi/paginated-reports/expressions/filter-equation-examples-report-builder_source=recommendations This example shows how to filter text fields using the IN operator in Power BI. It allows you to include data that starts with specific characters, making it useful for categorizing or segmenting text-based data. ```Power BI Expressions =LEFT(Fields!Subcat.Value,1) IN B, C, T ``` -------------------------------- ### Power BI Deep Link - Open App Example Source: https://learn.microsoft.com/fr-fr/power-bi/consumer/mobile/mobile-apps-deep-link-specific-location An example of a Power BI deep link to open a specific application. It requires the 'action' parameter set to 'OpenApp', the application's unique ID ('appId'), and optionally the tenant ID ('ctid'). ```text https://app.powerbi.com/Redirect?action=OpenApp&appId=&ctid= ``` -------------------------------- ### Installer les dépendances React pour Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/create-react-visual Installez les packages React et React DOM nécessaires pour le développement de visuels Power BI personnalisés. Ces packages sont essentiels pour créer des composants d'interface utilisateur React. ```powershell npm i react react-dom ``` -------------------------------- ### Redirect Users to Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install This section describes how to redirect users to Power BI using a POST method with the generated install ticket to complete the template app installation. ```APIDOC ## POST /app/install-url ### Description Redirects users to Power BI with the installation ticket to complete the template app setup. This is typically done via an HTML form submission. ### Method POST ### Endpoint /app/install-url (This is a conceptual endpoint; the actual URL is provided by Power BI during ticket creation) ### Parameters #### Request Body - **ticket** (string) - Required - The installation ticket generated by the CreateInstallTicket API. ### Request Example (HTML Form) ```html
``` ### Response #### Success Response (200) - **Content** (string) - HTML content that automatically submits a form to the Power BI installation URL. #### Response Example (C# Helper Method) ```csharp public static string RedirectWithData(string url, string ticket) { StringBuilder s = new StringBuilder(); s.Append(""); s.AppendFormat(""); s.AppendFormat("
", url); s.AppendFormat("", ticket); s.Append("
"); return s.ToString(); } ``` ``` -------------------------------- ### Power BI Project File Structure Example Source: https://learn.microsoft.com/fr-fr/power-bi/developer/projects/projects-overview_source=recommendations This example illustrates the typical directory structure when saving a Power BI report as a project. It includes folders for the report and semantic model, a .gitignore file, and the main .pbip project file. ```md Project/ ├── AdventureWorks.Report/ ├── AdventureWorks.SemanticModel/ ├── .gitignore └── AdventureWorks.pbip ``` -------------------------------- ### Power BI API - Get Refreshes Endpoint Response Example (JSON) Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/asynchronous-refresh_source=recommendations This JSON snippet illustrates the expected response body when using the GET /refreshes endpoint to list historical, current, and pending refresh operations. It details the structure of each refresh operation object, including its unique identifier, type, timing, and status. ```json [ { "requestId": "ddddeeee-3333-ffff-4444-aaaa5555bbbb", "refreshType": "ViaEnhancedApi", "startTime": "2020-12-07T02:06:57.1838734Z", "endTime": "2020-12-07T02:07:00.4929675Z", "status": "Completed", "extendedStatus": "Completed" }, { "requestId": "474fc5a0-3d69-4c5d-adb4-8a846fa5580b", "startTime": "2020-12-07T01:05:54.157324Z", "refreshType": "ViaEnhancedApi", "status": "Unknown" } { "requestId": "85a82498-2209-428c-b273-f87b3a1eb905", "refreshType": "ViaEnhancedApi", "startTime": "2020-12-07T01:05:54.157324Z", "status": "Unknown", "extendedStatus": "NotStarted" } ] ``` -------------------------------- ### Activer le programme d'expérience utilisateur pour Power BI Desktop Source: https://learn.microsoft.com/fr-fr/power-bi/fundamentals/desktop-get-the-desktop_source=recommendations Définissez la propriété ENABLECXP sur 1 pour activer le programme d'expérience utilisateur, qui collecte des informations sur l'utilisation du produit. ```shell msiexec.exe "C:\Path\To\PowerBI.msi" ENABLECXP=1 ``` -------------------------------- ### HTML Link for Contribution Guide Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/desktop-quickstart-connect-to-data_source=recommendations This HTML snippet defines a footer link for 'Collaboration', pointing to the contributor guide on Microsoft Learn. It includes standard attributes for external links and analytics. The 'href' directs users to the page on how to contribute to Microsoft Learn. ```html Collaboration ``` -------------------------------- ### Exemple d'URL d'installation d'application Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install-tutorial Cette URL est un exemple de la structure d'une URL d'installation d'application Power BI. Elle contient les paramètres nécessaires tels que appId, packageKey et ownerId qui doivent être extraits pour la configuration. ```plaintext https://app.powerbi.com/Redirect?action=InstallApp&appId=3c386...16bf71c67&packageKey=b2df4b...dLpHIUnum2pr6k&ownerId=72f9...1db47&buildVersion=5 ``` -------------------------------- ### Installation du module de gestion Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/guidance/powerbi-implementation-planning-auditing-monitoring-tenant-level-auditing Cette commande utilise PowerShellGet pour installer le module de gestion Power BI. Il est recommandé d'installer le module cumulatif pour avoir accès à toutes les cmdlets. ```powershell Install-Module -Name MicrosoftPowerBIManagement ``` -------------------------------- ### Power BI Visuals Test Utilities Installation Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-test Instructions on how to install the Power BI Visuals Test Utilities using npm. ```APIDOC ## Installation To install the test utilities and add its dependency to your `package.json` file, run the following command from your Power BI visuals directory: ```bash npm install powerbi-visuals-utils-testutils --save ``` ``` -------------------------------- ### Flux de base pour l'automatisation de l'installation d'une application modèle Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install Décrit le flux d'interactions entre le portail ISV et Power BI pour automatiser l'installation d'une application modèle. ```APIDOC ## Flux de base pour l'automatisation de l'installation d'une application modèle ### Description Le flux de base de l'automatisation de la configuration de l'installation d'une application modèle implique plusieurs étapes clés, allant de la connexion de l'utilisateur au portail ISV à l'installation finale de l'application modèle dans Power BI. ### Étapes du flux : 1. **Connexion de l'utilisateur au portail ISV** : L'utilisateur se connecte au portail du fournisseur de services indépendant (ISV) et sélectionne un lien spécial, déclenchant le flux automatisé. 2. **Acquisition du jeton d'application uniquement par l'ISV** : L'ISV obtient un jeton d'application uniquement basé sur un principal de service enregistré dans son locataire. 3. **Création du ticket d'installation** : L'ISV utilise les API REST Power BI pour créer un "ticket d'installation" contenant la configuration des paramètres spécifiques à l'utilisateur. 4. **Redirection vers Power BI avec le ticket d'installation** : L'ISV redirige l'utilisateur vers Power BI via une requête POST contenant le ticket d'installation. 5. **Installation de l'application modèle par l'utilisateur** : L'utilisateur est invité à installer l'application modèle dans son compte Power BI. Après authentification auprès de sa source de données, l'application s'installe automatiquement. ### API REST Power BI utilisées : - API pour la création d'un "ticket d'installation". ``` -------------------------------- ### Azure Function API Installation (POST) Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install-tutorial_source=recommendations Cette requête POST est adressée à votre fonction Azure pour installer des éléments. Le corps de la demande doit contenir des paires clé-valeur où la clé est le nom du paramètre et la valeur est la valeur souhaitée à définir. Assurez-vous que le format est correct pour une configuration réussie. ```http POST /api/install Content-Type: application/x-www-form-urlencoded parameter1=value1¶meter2=value2 ``` -------------------------------- ### Get Gateways API Source: https://learn.microsoft.com/fr-fr/power-bi/guidance/powerbi-implementation-planning-data-gateways_source=recommendations Retrieve a list of gateways programmatically using the Power BI REST APIs. ```APIDOC ## GET /gateways ### Description Retrieves a list of gateways available to the user. ### Method GET ### Endpoint /gateways ### Parameters #### Query Parameters - **$top** (integer) - Optional - The maximum number of records to return. - **$skip** (integer) - Optional - The number of records to skip for pagination. ### Request Example ```json { "example": "GET /gateways?$top=100&$skip=0" } ``` ### Response #### Success Response (200) - **value** (array) - A list of gateway resources. - **id** (string) - The gateway ID. - **name** (string) - The gateway name. - **type** (string) - The gateway type. - ** ** (string) - The gateway status. #### Response Example ```json { "example": "{\n \"value\": [\n {\n \"id\": \"gateway-id-1\",\n \"name\": \"MyGateway\",\n \"type\": \"standard\",\n \"status\": \"online\"\n }\n ]\n}" } ``` ``` -------------------------------- ### Create Power BI Install Ticket Request (C#) Source: https://learn.microsoft.com/fr-fr/power-bi/connect-data/template-apps-auto-install This C# code demonstrates how to create an installation ticket request for a Power BI template app using the Power BI API V2 SDK. It specifies details like AppId, PackageKey, OwnerTenantId, and configuration parameters. ```csharp using Microsoft.PowerBI.Api.V2; using Microsoft.PowerBI.Api.V2.Models; // Create Install Ticket Request. InstallTicket ticketResponse = null; var request = new CreateInstallTicketRequest() { InstallDetails = new List() { new TemplateAppInstallDetails() { AppId = Guid.Parse(AppId), PackageKey = PackageKey, OwnerTenantId = Guid.Parse(OwnerId), Config = new TemplateAppConfigurationRequest() { Configuration = Parameters .GroupBy(p => p.Name) .ToDictionary(k => k.Key, k => k.Select(p => p.Value).Single()) } } } }; // Issue the request to the REST API using .NET SDK. InstallTicket ticketResponse = await client.TemplateApps.CreateInstallTicketAsync(request); ``` -------------------------------- ### Installer Power BI Tooltip Utils Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-tooltip Installe le package 'powerbi-visuals-utils-tooltiputils' dans votre projet de visuel personnalisé Power BI. Cette commande ajoute le package en tant que dépendance à votre fichier 'package.json'. ```bash npm install powerbi-visuals-utils-tooltiputils --save ``` -------------------------------- ### GET /v1.0/myorg/admin/activityevents Source: https://learn.microsoft.com/fr-fr/power-bi/enterprise/service-admin-auditing_source=recommendations Retrieves activity events from Power BI. You must specify a start and end date, which should be the same day. The API supports downloading up to one day of data per request. Dates must be in UTC format. ```APIDOC ## GET /v1.0/myorg/admin/activityevents ### Description Retrieves activity events from Power BI for a specified day. This endpoint is used for administrative purposes to export activity logs into storage for custom reporting. ### Method GET ### Endpoint `https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime={UTC_DateTime}&endDateTime={UTC_DateTime}` ### Parameters #### Query Parameters - **startDateTime** (string) - Required - The start of the date and time range for the activity events in UTC format (e.g., '2019-08-31T00:00:00'). - **endDateTime** (string) - Required - The end of the date and time range for the activity events in UTC format (e.g., '2019-08-31T23:59:59'). Must be the same day as `startDateTime`. - **continuationToken** (string) - Optional - A token returned from a previous request to retrieve the next batch of results when the dataset is large. ### Request Example ```http https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime='2019-08-31T00:00:00'&endDateTime='2019-08-31T23:59:59' ``` ### Response #### Success Response (200) - **activityEventEntities** (array) - An array of activity event objects. - **continuationUri** (string) - A URI to retrieve the next set of results if available. - **continuationToken** (string) - A token to use in subsequent requests to get the next batch of entries. - **lastResultSet** (boolean) - Indicates if this is the last set of results. #### Response Example ```json { "activityEventEntities": [ // ... activity event objects ... ], "continuationUri": "https://wabi-staging-us-east-redirect.analysis.windows.net/v1.0/myorg/admin/activityevents?continuationToken='LDIwMjAtMDgtMTNUMDc6NTU6MDBaLDIwMjAtMDgtMTNUMDk6MDA6MDBaLDEsLA%3D%3D'", "continuationToken": "LDIwMjAtMDgtMTNUMDc6NTU6MDBaLDIwMjAtMDgtMTNUMDk6MDA6MDBaLDEsLA%3D%3D", "lastResultSet": false } ``` ### Error Handling - If the results include a continuation token, continue to call the API using that token to get the rest of the data until a continuation token is no longer returned. - It's possible for a call to return a continuation token without any event entries. - The API currently supports downloading up to one day of data per request. The start and end dates must specify the same day. ``` -------------------------------- ### Installer ChartUtils avec npm Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-chart_source=recommendations Pour installer le package ChartUtils, exécutez cette commande dans le répertoire de votre visuel Power BI actuel. Elle ajoute le package aux dépendances de votre projet. ```bash npm install powerbi-visuals-utils-chartutils --save ``` -------------------------------- ### Installer les dépendances de l'application Power BI Source: https://learn.microsoft.com/fr-fr/power-bi/developer/embedded/embed-sample-for-your-organization Cette commande installe toutes les dépendances nécessaires pour exécuter l'exemple d'application d'incorporation Power BI. Assurez-vous d'être dans le répertoire racine de l'application avant d'exécuter cette commande. ```bash npm install ``` -------------------------------- ### GET /v1.0/myorg/groups Source: https://learn.microsoft.com/fr-fr/power-bi/developer/embedded/service-principal-profile-sdk_source=recommendations Retrieves a list of groups from Power BI. This example shows how to include a custom profile header for authentication. ```APIDOC ## GET /v1.0/myorg/groups ### Description Retrieves a list of groups from the Power BI service. This example demonstrates the use of a custom `X-PowerBI-profile-id` header, which is necessary when the profile is not set as a default in the client. ### Method GET ### Endpoint `https://powerbiapi.analysis-df.windows.net/v1.0/myorg/groups` ### Headers - **Authorization** (string) - Required - Bearer token for authentication. - **X-PowerBI-profile-id** (string) - Required - The ID of the profile to use for the request. ``` -------------------------------- ### Power BI Project Folder Structure Example Source: https://learn.microsoft.com/fr-fr/power-bi/developer/projects/projects-overview This example illustrates a typical folder structure for a Power BI project. It includes separate directories for reports and semantic models, each with their definition files, along with the project configuration file (.pbip) and the .gitignore file. ```tree project/ ├── AdventureWorks-Sales.Report/ │ └── definition.pbir ├── AdventureWorks-Stocks.Report/ │ └── definition.pbir ├── AdventureWorks.SemanticModel/ │ └── definition.pbism ├── .gitignore └── AdventureWorks.pbip ``` -------------------------------- ### PBIR Folder Structure Example (Markdown) Source: https://learn.microsoft.com/fr-fr/power-bi/developer/projects/projects-report_source=recommendations&tabs=v2%2Cdesktop This example shows the typical folder and file structure for a Power BI Report (PBIR) project. It includes directories for bookmarks and pages, with subdirectories for visuals within each page. ```markdown ├── bookmarks\ │ ├── [bookmarkName].bookmark.json | └── bookmarks.json ├── pages\ │ ├── [pageName]\ │ | ├── \visuals | │ | ├── [visualName]\ ``` -------------------------------- ### Installation de powerbi-visuals-utils-typeutils Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/utils-type Installe le package powerbi-visuals-utils-typeutils et l'ajoute comme dépendance dans le fichier package.json. Cette commande doit être exécutée dans le répertoire de votre visuel personnalisé. ```bash npm install powerbi-visuals-utils-typeutils --save ``` -------------------------------- ### Power BI Local Storage API v2: Get, Set, and Status Source: https://learn.microsoft.com/fr-fr/power-bi/developer/visuals/local-storage_source=recommendations This TypeScript example illustrates the usage of Version 2 of the Power BI Local Storage API. It shows how to check the API's status using `status()`, retrieve data with `get(key)`, and store data with `set(key, data)`. This version requires `IVisualLocalStorageV2Service` and handles promises for asynchronous operations. ```typescript import IVisualLocalStorageV2Service = powerbi.extensibility.IVisualLocalStorageV2Service; import StorageV2ResultInfo = powerbi.extensibility.StorageV2ResultInfo; import PrivilegeStatus = powerbi.PrivilegeStatus; export class Visual implements IVisual { // ... private updateCountName: string = 'updateCount'; private updateCount: number; private storageV2Service: IVisualLocalStorageV2Service; constructor(options: VisualConstructorOptions) { this.storageV2Service = options.host.storageV2Service; this.init(); } private async init() { try { let status: powerbi.PrivilegeStatus = await this.storageV2Service.status(); ```