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
[HttpPost] | |
public async Task<IActionResult> CSharp(Code code) | |
{ | |
string output = code.csx; | |
var apiURL = "https://www.microsoft.com/net/api/code"; | |
using (var client = new HttpClient()) | |
{ | |
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, new Uri(apiURL)); |
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
function loadGet() { | |
document.getElementById("csxEditor").innerHTML = ""; | |
var strGetTemplate = [ | |
'using System;', | |
'using System.Net.Http;', | |
'\npublic class HelloAPI', | |
'{', | |
'\tpublic static void Main()', | |
'\t{', | |
'\t\tusing (var client = new HttpClient())', |
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.IO; | |
using System.Threading; | |
using System.Net.Http.Headers; | |
using Newtonsoft.Json; | |
using Microsoft.Azure.Management.DataLake.Store; | |
using Microsoft.Azure.Management.DataLake.Store.Models; | |
using Microsoft.IdentityModel.Clients.ActiveDirectory; | |
using Microsoft.Rest.Azure.Authentication; |
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
REFERENCE ASSEMBLY [Newtonsoft.Json]; | |
REFERENCE ASSEMBLY [Microsoft.Analytics.Samples.Formats]; | |
DECLARE @out string="adl://contoso.azuredatalakestore.net/foo/delayedDepartures.csv"; | |
@departure = | |
EXTRACT DataFrameRef string, | |
DatedVehicleJourneyRef string, | |
DestinationName string, | |
AimedArrivalTime string, |
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 System.Security.Cryptography; | |
public static void Run(string input, TraceWriter log) | |
{ | |
var resourceUri = "contoso.servicebus.windows.net"; | |
var keyName = "RootManageSharedAccessKey"; |
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
<inbound> | |
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized"> | |
<openid-config url="https://login.microsoftonline.com/common/.well-known/openid-configuration" /> | |
<audiences> | |
<audience>https://management.core.windows.net/</audience> | |
</audiences> | |
<required-claims /> | |
</validate-jwt> | |
<set-header name="Authorization" exists-action="override"> | |
<value>@{ |
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; | |
public static void Run(string input, TraceWriter log) | |
{ | |
log.Info($"C# manually triggered function called with input: {input}"); | |
var apimUrl = " https://contosio.azure-api.net/foo/messages"; |
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}"); |
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
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); | |
} |