Skip to content

Commit da09ad7

Browse files
committed
docs, webapp auth
1 parent 86d8e24 commit da09ad7

File tree

8 files changed

+270
-35
lines changed

8 files changed

+270
-35
lines changed

Modules/PowerBIPS/PowerBIPS.psm1

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,25 @@ The redirect URI associated with the native client application
162162
.PARAMETER ForceAskCredentials
163163
Forces the authentication popup to always ask for the username and password
164164
165+
.PARAMETER tenantId
166+
The Azure AD Tenant Id, optional and only needed if you are using the App Authentication Flow
167+
168+
.PARAMETER clientSecret
169+
The Azure AD client secret, optional and only needed it the ClientId is a Azure AD WebApp type
170+
165171
.EXAMPLE
166-
Get-PBIAuthToken -clientId "C0E8435C-614D-49BF-A758-3EF858F8901B"
167-
Returns the access token for the PowerBI REST API using the client ID. You'll be presented with a pop-up window for
172+
# Returns the access token for the PowerBI REST API using the client ID. You'll be presented with a pop-up window for
168173
user authentication.
174+
Get-PBIAuthToken -clientId "C0E8435C-614D-49BF-A758-3EF858F8901B"
169175
.EXAMPLE
176+
# Returns the access token for the PowerBI REST API using the client ID and a PSCredential object.
170177
$Credential = Get-Credential
171178
Get-PBIAuthToken -ClientId "C0E8435C-614D-49BF-A758-3EF858F8901B" -Credential $Credential
172-
Returns the access token for the PowerBI REST API using the client ID and a PSCredential object.
179+
.EXAMPLE
180+
# Using an Azure AD WebApp
181+
$Credential = Get-Credential
182+
Get-PBIAuthToken -ClientId "C0E8435C-614D-49BF-A758-3EF858F8901B" -tenantId "company.onmicrosoft.com" -clientSecret "<Azure AD APP Secret>"
183+
173184
#>
174185

175186
[CmdletBinding()]
@@ -262,16 +273,23 @@ Returns the access token for the PowerBI REST API using the client ID and a PSCr
262273
$AuthResult = $script:authContext.AcquireTokenAsync($script:pbiResourceUrl, $clientId, [Uri]$redirectUri, $pltParams).Result
263274
}
264275

265-
Write-Verbose -Message "Authenticated as $($AuthResult.UserInfo.DisplayableId)"
266-
267-
if ($returnADALObj)
276+
if ($AuthResult -eq $null)
268277
{
269-
Write-Output $AuthResult
278+
throw "Cannot get the access token, AcquireTokenAsync returned null"
270279
}
271280
else
272281
{
273-
Write-Output $AuthResult.AccessToken
274-
}
282+
Write-Verbose -Message "Authenticated as $($AuthResult.UserInfo.DisplayableId)"
283+
284+
if ($returnADALObj)
285+
{
286+
Write-Output $AuthResult
287+
}
288+
else
289+
{
290+
Write-Output $AuthResult.AccessToken
291+
}
292+
}
275293
}
276294

277295
Function Get-PBIAuthTokenHttp

Modules/PowerBIPS/doc/Get-PBIAuthToken.md

Lines changed: 70 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@ Gets the authentication token required to comunicate with the PowerBI API's
1212

1313
## SYNTAX
1414

15-
### default (Default)
1615
```
17-
Get-PBIAuthToken [-ForceAskCredentials] [-clientId <String>] [-redirectUri <String>] [<CommonParameters>]
18-
```
19-
20-
### credential
21-
```
22-
Get-PBIAuthToken -Credential <Object> [<CommonParameters>]
16+
Get-PBIAuthToken [[-credential] <Object>] [-forceAskCredentials] [[-clientId] <String>]
17+
[[-redirectUri] <String>] [[-tenantId] <String>] [[-clientSecret] <String>] [-returnADALObj]
18+
[<CommonParameters>]
2319
```
2420

2521
## DESCRIPTION
@@ -33,47 +29,54 @@ It will automatically download and install the required nuget: "Microsoft.Identi
3329

3430
### EXAMPLE 1
3531
```
36-
Get-PBIAuthToken -clientId "C0E8435C-614D-49BF-A758-3EF858F8901B"
32+
# Returns the access token for the PowerBI REST API using the client ID. You'll be presented with a pop-up window for
3733
```
3834

39-
Returns the access token for the PowerBI REST API using the client ID.
40-
You'll be presented with a pop-up window for
4135
user authentication.
36+
Get-PBIAuthToken -clientId "C0E8435C-614D-49BF-A758-3EF858F8901B"
4237

4338
### EXAMPLE 2
4439
```
45-
$Credential = Get-Credential
40+
# Returns the access token for the PowerBI REST API using the client ID and a PSCredential object.
4641
```
4742

43+
$Credential = Get-Credential
4844
Get-PBIAuthToken -ClientId "C0E8435C-614D-49BF-A758-3EF858F8901B" -Credential $Credential
49-
Returns the access token for the PowerBI REST API using the client ID and a PSCredential object.
45+
46+
### EXAMPLE 3
47+
```
48+
# Using an Azure AD WebApp
49+
```
50+
51+
$Credential = Get-Credential
52+
Get-PBIAuthToken -ClientId "C0E8435C-614D-49BF-A758-3EF858F8901B" -tenantId "company.onmicrosoft.com" -clientSecret "\<Azure AD APP Secret\>"
5053

5154
## PARAMETERS
5255

53-
### -Credential
56+
### -credential
5457
Specifies a PSCredential object or a string username used to authenticate to PowerBI.
5558
If only a username is specified
5659
this will prompt for the password.
5760
Note that this will not work with federated users.
5861

5962
```yaml
6063
Type: Object
61-
Parameter Sets: credential
64+
Parameter Sets: (All)
6265
Aliases:
6366

64-
Required: True
65-
Position: Named
67+
Required: False
68+
Position: 1
6669
Default value: None
6770
Accept pipeline input: False
6871
Accept wildcard characters: False
6972
```
7073
71-
### -ForceAskCredentials
74+
### -forceAskCredentials
7275
Forces the authentication popup to always ask for the username and password
7376
7477
```yaml
7578
Type: SwitchParameter
76-
Parameter Sets: default
79+
Parameter Sets: (All)
7780
Aliases:
7881

7982
Required: False
@@ -88,11 +91,11 @@ The Client Id of the Azure AD application
8891
8992
```yaml
9093
Type: String
91-
Parameter Sets: default
94+
Parameter Sets: (All)
9295
Aliases:
9396

9497
Required: False
95-
Position: Named
98+
Position: 2
9699
Default value: None
97100
Accept pipeline input: False
98101
Accept wildcard characters: False
@@ -103,16 +106,61 @@ The redirect URI associated with the native client application
103106
104107
```yaml
105108
Type: String
106-
Parameter Sets: default
109+
Parameter Sets: (All)
107110
Aliases:
108111

109112
Required: False
110-
Position: Named
113+
Position: 3
114+
Default value: None
115+
Accept pipeline input: False
116+
Accept wildcard characters: False
117+
```
118+
119+
### -tenantId
120+
The Azure AD Tenant Id, optional and only needed if you are using the App Authentication Flow
121+
122+
```yaml
123+
Type: String
124+
Parameter Sets: (All)
125+
Aliases:
126+
127+
Required: False
128+
Position: 4
129+
Default value: None
130+
Accept pipeline input: False
131+
Accept wildcard characters: False
132+
```
133+
134+
### -clientSecret
135+
The Azure AD client secret, optional and only needed it the ClientId is a Azure AD WebApp type
136+
137+
```yaml
138+
Type: String
139+
Parameter Sets: (All)
140+
Aliases:
141+
142+
Required: False
143+
Position: 5
111144
Default value: None
112145
Accept pipeline input: False
113146
Accept wildcard characters: False
114147
```
115148
149+
### -returnADALObj
150+
{{Fill returnADALObj Description}}
151+
152+
```yaml
153+
Type: SwitchParameter
154+
Parameter Sets: (All)
155+
Aliases:
156+
157+
Required: False
158+
Position: Named
159+
Default value: False
160+
Accept pipeline input: False
161+
Accept wildcard characters: False
162+
```
163+
116164
### CommonParameters
117165
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
118166
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
external help file: PowerBIPS-help.xml
3+
Module Name: PowerBIPS
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# Get-PBIAuthTokenHttp
9+
10+
## SYNOPSIS
11+
Gets the authentication token required to comunicate with the PowerBI API's
12+
13+
## SYNTAX
14+
15+
```
16+
Get-PBIAuthTokenHttp [-tenantId] <String> [-clientId] <String> [[-clientSecret] <String>] [<CommonParameters>]
17+
```
18+
19+
## DESCRIPTION
20+
Gets the authentication token required to comunicate with the PowerBI API's
21+
22+
## EXAMPLES
23+
24+
### Example 1
25+
```powershell
26+
PS C:\> {{ Add example code here }}
27+
```
28+
29+
{{ Add example description here }}
30+
31+
## PARAMETERS
32+
33+
### -tenantId
34+
{{Fill tenantId Description}}
35+
36+
```yaml
37+
Type: String
38+
Parameter Sets: (All)
39+
Aliases:
40+
41+
Required: True
42+
Position: 1
43+
Default value: None
44+
Accept pipeline input: False
45+
Accept wildcard characters: False
46+
```
47+
48+
### -clientId
49+
{{Fill clientId Description}}
50+
51+
```yaml
52+
Type: String
53+
Parameter Sets: (All)
54+
Aliases:
55+
56+
Required: True
57+
Position: 2
58+
Default value: None
59+
Accept pipeline input: False
60+
Accept wildcard characters: False
61+
```
62+
63+
### -clientSecret
64+
{{Fill clientSecret Description}}
65+
66+
```yaml
67+
Type: String
68+
Parameter Sets: (All)
69+
Aliases:
70+
71+
Required: False
72+
Position: 3
73+
Default value: None
74+
Accept pipeline input: False
75+
Accept wildcard characters: False
76+
```
77+
78+
### CommonParameters
79+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
80+
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
81+
82+
## INPUTS
83+
84+
## OUTPUTS
85+
86+
### System.String
87+
88+
## NOTES
89+
90+
## RELATED LINKS

Modules/PowerBIPS/doc/Get-PBIDataSet.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Check if a dataset exists with the specified name and if exists returns it's met
1616

1717
```
1818
Get-PBIDataSet [[-authToken] <String>] [[-name] <String>] [[-id] <String>] [-includeDefinition]
19-
[-includeTables] [[-groupId] <String>] [<CommonParameters>]
19+
[-includeTables] [[-groupId] <String>] [-admin] [<CommonParameters>]
2020
```
2121

2222
## DESCRIPTION
@@ -127,6 +127,21 @@ Accept pipeline input: False
127127
Accept wildcard characters: False
128128
```
129129
130+
### -admin
131+
{{Fill admin Description}}
132+
133+
```yaml
134+
Type: SwitchParameter
135+
Parameter Sets: (All)
136+
Aliases:
137+
138+
Required: False
139+
Position: Named
140+
Default value: False
141+
Accept pipeline input: False
142+
Accept wildcard characters: False
143+
```
144+
130145
### CommonParameters
131146
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
132147
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

Modules/PowerBIPS/doc/Get-PBIGroup.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Gets all the PowerBI existing workspaces
1313
## SYNTAX
1414

1515
```
16-
Get-PBIGroup [[-authToken] <String>] [[-name] <String>] [[-id] <String>] [<CommonParameters>]
16+
Get-PBIGroup [[-authToken] <String>] [[-name] <String>] [[-id] <String>] [-admin] [-withUsers]
17+
[<CommonParameters>]
1718
```
1819

1920
## DESCRIPTION
@@ -74,6 +75,36 @@ Accept pipeline input: False
7475
Accept wildcard characters: False
7576
```
7677
78+
### -admin
79+
{{Fill admin Description}}
80+
81+
```yaml
82+
Type: SwitchParameter
83+
Parameter Sets: (All)
84+
Aliases:
85+
86+
Required: False
87+
Position: Named
88+
Default value: False
89+
Accept pipeline input: False
90+
Accept wildcard characters: False
91+
```
92+
93+
### -withUsers
94+
{{Fill withUsers Description}}
95+
96+
```yaml
97+
Type: SwitchParameter
98+
Parameter Sets: (All)
99+
Aliases:
100+
101+
Required: False
102+
Position: Named
103+
Default value: False
104+
Accept pipeline input: False
105+
Accept wildcard characters: False
106+
```
107+
77108
### CommonParameters
78109
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
79110
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

0 commit comments

Comments
 (0)