Skip to content

Instantly share code, notes, and snippets.

View christopherhouse's full-sized avatar
😀

Christopher House christopherhouse

😀
  • Microsoft
  • St. Paul, MN
View GitHub Profile
@christopherhouse
christopherhouse / keyVault
Created August 11, 2022 02:17
Example modules for a Key Vault and Key Vault Secrets
param keyVaultName string
param location string = resourceGroup().location
param tenantId string = subscription().tenantId
param adminUserObjectIds array
param applicationUserObjectIds array
var adminAccessPolicies = [for adminUser in adminUserObjectIds: {
objectId: adminUser
tenantId: tenantId
permissions: {
$(document).ready(function() {
$("#ajaxLink").click(function (event) {
event.preventDefault();
$.get("/Home/GetData").error(function(jqxhr) {
var errorObject = JSON.parse(jqxhr.responseText);
$("#errorMessage").text(errorObject.message);
});
});
});
protected void Application_Error(object sender, EventArgs e)
{
Exception lastError = Server.GetLastError();
Server.ClearError();
int statusCode = 0;
if (lastError.GetType() == typeof(HttpException))
{
statusCode = ((HttpException) lastError).GetHttpCode();
using System;
using System.Web.Mvc;
using ThirteenDaysAWeek.Mvc4CustomErrorPage.Web.Models;
namespace ThirteenDaysAWeek.Mvc4CustomErrorPage.Web.Controllers
{
public class ErrorController : Controller
{
public ActionResult Index(int statusCode, Exception exception, bool isAjaxRequet)
{
using System;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.MobileServices;
using ThirteenDaysAWeek.AzureCustomAuth.Handlers;
using ThirteenDaysAWeek.AzureCustomAuth.Factories;
using ThirteenDaysAWeek.AzureCustomAuth.Models;
namespace ThirteenDaysAWeek.AzureCustomAuth.Services
{
public class TestDataService
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using ThirteenDaysAWeek.AzureCustomAuth.Services;
namespace ThirteenDaysAWeek.AzureCustomAuth.Handlers
{
public class ZumoAuthHeaderHandler : DelegatingHandler
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.MobileServices;
using ThirteenDaysAWeek.AzureCustomAuth.Models;
using ThirteenDaysAWeek.AzureCustomAuth.Handlers;
using ThirteenDaysAWeek.AzureCustomAuth.Factories;
namespace ThirteenDaysAWeek.AzureCustomAuth.Services
{
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using ThirteenDaysAWeek.AzureCustomAuth.Services;
namespace ThirteenDaysAWeek.AzureCustomAuth.Handlers
{
public class AuthenticationHandler : DelegatingHandler
{
public async Task DoInsert()
{
using (MobileServiceClient client = new MobileServiceClient(URL, KEY))
{
var table = client.GetTable<EntityType>();
var entity = new EntityType();
await table.InsertAsync(entity);
}
}
// Thanks to Chris Risner for his blog post, http://chrisrisner.com/Authentication-with-Windows-Azure-Mobile-Services
// This script comes from his post, with a couple of minor modifications
var crypto = require('crypto');
var iterations = 1000;
var bytes = 32;
var aud = "Custom";
var masterKey = "wkeHEoWUaPJSHsSOcWgmVLOZbIpeeg92";
function insert(item, user, request) {
console.log("Executing insert script on accounts table");