Invoke-PowerBIRestMethod

Executes a REST call to the Power BI service, with the specified URL and body.

Syntax

Invoke-PowerBIRestMethod
      -Url <String>
      -Method <PowerBIWebRequestMethod>
      [-Body <String>]
      [-OutFile <String>]
      [-ContentType <String>]
      [-Headers <Hashtable>]
      [-TimeoutSec <Int32>]
      [-Organization <String>]
      [-Version <String>]
      [<CommonParameters>]

Description

Invokes a REST request against the Power BI service using the profile you're logged in with. The REST verb can be specified using the -Method parameter. The -Body parameter is required for the verbs POST, PUT, and PATCH. Before you run this command, make sure you log in using Connect-PowerBIServiceAccount.

Examples

Example 1

PS C:\> Invoke-PowerBIRestMethod -Url 'groups' -Method Get

Invokes the URL https://api.powerbi.com/v1.0/myorg/groups with the GET method\verb.

Parameters

-Body

Body of the request, also known as content. This is optional unless the request method is POST, PUT, or PATCH.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ContentType

Content type to specify inside the header for the request. Default is 'application/json'.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Headers

Optional headers to include with the request.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Method

Type of HTTP request method\verb to make with the call.

Type:PowerBIWebRequestMethod
Accepted values:Get, Post, Delete, Put, Patch, Options
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Organization

Organization name or tenant GUID to include in the URL. Default is 'myorg'.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OutFile

Output file for writing the response content to. File path specified must not exist.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TimeoutSec

Specifies how long the request can be pending before it times out. Enter a value in seconds. Entering a value of 0 specifies an indefinite time-out.

Type:Int32
Position:Named
Default value:100
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Url

Relative or absolute URL of the Power BI entity you want to access. For example, if you want to access https://api.powerbi.com/v1.0/myorg/groups, then specify 'groups', or pass in the entire URL.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Version

Version of the API to include in the URL. Default is 'v1.0'. Ignored if -Url is an absolute URL.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

System.Object

Notes