Skip to content

Instantly share code, notes, and snippets.

View shawnweisfeld's full-sized avatar

Shawn Weisfeld shawnweisfeld

View GitHub Profile
public void SignIn(string authType)
{
// Send an OpenID Connect sign-in request.
if (!Request.IsAuthenticated)
{
string callbackUrl = Url.Action("SignInCallback", "Account", routeValues: new { authType = authType }, protocol: Request.Url.Scheme);
HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = callbackUrl },
authType);
}
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId,
Authority = $"{aadInstanceGov}common",
PostLogoutRedirectUri = postLogoutRedirectUri,
AuthenticationType = "AADC",
TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters
{
// instead of using the default validation (validating against a single issuer value, as we do in line of business apps),
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId,
Authority = aadInstance + tenantId,
PostLogoutRedirectUri = postLogoutRedirectUri,
AuthenticationType = "AADC"
});
app.UseOpenIdConnectAuthentication(
$Link = "[Full path to where you copied the VHD]"
$S = New-AzureVMImageDiskConfigSet
Set-AzureVMImageOSDiskConfig -DiskConfig $S -HostCaching ReadWrite -OSState "Generalized" -OS "Linux" -MediaLink $Link
$IMGName = "Snapcloud";
Add-AzureVMImage -ImageName $IMGName -Label "SnapCloud" -Description "SnapCloud" -DiskConfig $S -Eula "http://sphere3d.com/snapcloud" -ImageFamily Linux -PublishedDate (Get-Date) -PrivacyUri "http://sphere3d.com/snapcloud" -RecommendedVMSize Small -IconName "Icon01" -SmallIconName "SmallIcon01" -ShowInGui
$un = "[User Name]"
$pwd = "[Password]"
$vmname="[VM Name]"
AzCopy /Source:[Container containing source image with SAS Signature] /Dest:[Path to Container in Azure G Storage Account] /DestKey:[My Key] /pattern:[Name of VHD]
$data = Get-Content c:\temp\pwd.txt
$secretvalue = $data | ConvertTo-SecureString
$creds = New-Object System.Management.Automation.PSCredential ('<<ApplicationID>>', $secretvalue )
Login-AzureRmAccount -Credential $creds -ServicePrincipal -TenantId <<TenantID GUID>>
$Password = '<<my password>>'
Login-AzureRmAccount
$azureAdApplication = New-AzureRmADApplication -DisplayName "MyPoshApp" -HomePage "https://www.contoso.org" -IdentifierUris "https://www.contoso.org/example" -Password $Password
$azureAdApplication
DisplayName : MyPoshApp
Type : Application
var vm = await HttpContext.Application.CacheAside("Home-IndexViewModel", 60,
async () =>
{
make temp
return tmp;
});
return View(vm);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
namespace BrewSite.Util
{
public static class HttpApplicationStateBaseExtension
{
@shawnweisfeld
shawnweisfeld / Unary2.cs
Created March 2, 2016 03:39
setting a child page
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EFUnary