This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM microsoft/aspnetcore-build:2.0 AS build-env | |
WORKDIR /app | |
# Copy csproj and restore as distinct layers | |
COPY *.csproj ./ | |
RUN dotnet restore | |
# Copy everything else and build | |
COPY . ./ | |
RUN dotnet publish -c Release -o out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1beta1 | |
kind: Deployment | |
metadata: | |
name: api-playground | |
spec: | |
template: | |
metadata: | |
labels: | |
app: api-playground | |
spec: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: api-playground-ingress | |
annotations: | |
nginx.ingress.kubernetes.io/rewrite-target: / | |
kubernetes.io/tls-acme: 'true' | |
spec: | |
tls: | |
- hosts: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: external-dns | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: ClusterRole | |
metadata: | |
name: external-dns | |
rules: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1beta1 | |
kind: Deployment | |
metadata: | |
name: api-playground | |
spec: | |
template: | |
metadata: | |
labels: | |
app: api-playground | |
spec: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet] | |
public async Task<IActionResult> LoginADAL() | |
{ | |
AuthenticationContext ctx = null; | |
ctx = new AuthenticationContext("https://login.microsoftonline.com/common"); | |
DeviceCodeResult codeResult = ctx.AcquireDeviceCodeAsync(resource, ClientId).Result; | |
DCR dcr = new DCR { message = codeResult.Message, | |
device_code = codeResult.DeviceCode, | |
expires_in = codeResult.ExpiresOn.ToString(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string ClientId = "guid-from-portal"; | |
string resource = "00000002-0000-0000-c000-000000000000"; | |
public class DCR | |
{ | |
public string device_code { get; set; } | |
public string message { get; set; } | |
public string user_code { get; set; } | |
public string interval { get; set; } | |
public string expires_in { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tokenCredentials = new TokenCredentials(token.access_token, "Bearer"); | |
// Create a Power BI Client object. It will be used to call Power BI APIs. | |
using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials)) | |
{ | |
// Generate Embed Token. | |
var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view"); | |
var tokenResponse = await client.Dashboards.GenerateTokenInGroupAsync(GroupId, dashboardId, | |
generateTokenRequestParameters); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PowerBI | |
{ | |
private static readonly string Username = "[email protected]"; | |
private static readonly string Password = "Pa$$w0rd"; | |
private static readonly string stsFqdn = "https://adfs.contoso.com"; | |
private static readonly string ResourceUrl = "https://analysis.windows.net/powerbi/api"; | |
private static readonly string ClientId = "guid-from-Azure-Portal"; | |
private static readonly string ClientSecret = "secret-from-Azure-Portal"; | |
private static readonly string ApiUrl = "https://api.powerbi.com/"; | |
private static readonly string GroupId = "group-guid"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using Newtonsoft.Json; | |
public static void Run(string input, TraceWriter log) | |
{ | |
log.Info($"C# manually triggered function called with input: {input}"); |