適用於 Node.js 的 Azure PowerBI Embedded 模組Azure PowerBI Embedded modules for Node.js

運用 Power BI Embedded Azure 服務,您可以將 Power BI 報告整合至 Node 應用程式以建立或編輯圖表和報告。With the Power BI Embedded Azure service, you can integrate Power BI reports right into your node application to create or edit charts and reports.

深入了解 Power BI EmbeddedLearn more about Power BI Embedded.

管理套件Management Package

安裝 npm 模組Install the npm module

安裝 Azure Power BI npm 模組Install the Azure Power BI npm module

npm install azure-arm-powerbiembedded

範例Example

此範例會在現有的資源群組中建立工作區集合。This example creates a workspace collection in an existing resource group.

const msRestAzure = require('ms-rest-azure');
const PowerBIEmbeddedManagementClient = require('azure-arm-powerbiembedded');

const creationOptions = {
  location: 'northcentralus',
  tags: {
    key1: 'value1',
    key2: 'value2'
  },
  sku: {
    name: 'S1',
    teir: 'Standard'
  }
};

const subscriptionId = 'your-subscription-id';
const resourceGroup = 'your-resource-group-name';
const workspace = 'workspace-collection-name';

msRestAzure
  .interactiveLogin()
  .then(credentials => {
    const client = new PowerBIEmbeddedManagementClient(
      credentials,
      subscriptionId
    );
    return client.workspaceCollections.create(
      resourceGroup,
      workspace,
      creationOptions
    );
  })
  .then(workspaces => console.dir(workspaces, { depth: null, colors: true }))
  .catch(err => console.log(err));

範例Samples

深入探索可在應用程式中使用的 Node.js 程式碼範例Explore more sample Node.js code you can use in your apps.