|
| 1 | +# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +Function Get-MonkeyPowerBIBackend{ |
| 16 | + <# |
| 17 | + .SYNOPSIS |
| 18 | + Returns PowerBI backend URL |
| 19 | +
|
| 20 | + .DESCRIPTION |
| 21 | + Returns PowerBI backend URL |
| 22 | +
|
| 23 | + .INPUTS |
| 24 | +
|
| 25 | + .OUTPUTS |
| 26 | +
|
| 27 | + .EXAMPLE |
| 28 | +
|
| 29 | + .NOTES |
| 30 | + Author : Juan Garrido |
| 31 | + Twitter : @tr1ana |
| 32 | + File Name : Get-MonkeyPowerBIBackend |
| 33 | + Version : 1.0 |
| 34 | +
|
| 35 | + .LINK |
| 36 | + https://github.com/silverhack/monkey365 |
| 37 | + #> |
| 38 | + |
| 39 | + Param () |
| 40 | + Begin{ |
| 41 | + #Getting environment |
| 42 | + $Environment = $O365Object.Environment |
| 43 | + #Set uri |
| 44 | + $rawQuery = ('{0}/v1.0/myorg/admin/groups?$top=1' -f $O365Object.Environment.PowerBIAPI); |
| 45 | + #Get Auth header |
| 46 | + $AuthHeader = @{ |
| 47 | + Authorization = $O365Object.auth_tokens.PowerBI.CreateAuthorizationHeader(); |
| 48 | + } |
| 49 | + } |
| 50 | + Process{ |
| 51 | + $p = @{ |
| 52 | + Url = $rawQuery; |
| 53 | + Headers = $AuthHeader; |
| 54 | + UserAgent = $O365Object.userAgent; |
| 55 | + Method = "GET"; |
| 56 | + Verbose = $O365Object.verbose; |
| 57 | + Debug = $O365Object.debug; |
| 58 | + InformationAction = $O365Object.InformationAction; |
| 59 | + } |
| 60 | + #Get dataset info |
| 61 | + $_object = Invoke-MonkeyWebRequest @p |
| 62 | + If($null -ne $_object){ |
| 63 | + [uri]$uri = $_object | Select-Object -ExpandProperty '@odata.context' -ErrorAction Ignore |
| 64 | + #return object |
| 65 | + ("https://{0}" -f $uri.DnsSafeHost) |
| 66 | + } |
| 67 | + } |
| 68 | + End{ |
| 69 | + #Nothing to do here |
| 70 | + } |
| 71 | +} |
| 72 | + |
0 commit comments