This file contains 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.Net; | |
using System.Net.Http; | |
using System.Security.Claims; | |
using System.Threading.Tasks; | |
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) | |
{ | |
log.Info("C# HTTP trigger function processed a request."); | |
This file contains 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
# escape=` | |
# Image with SDK to build .NET Core application from source | |
FROM microsoft/aspnetcore-build:2.0.0-nanoserver As builder | |
WORKDIR /source/ | |
COPY source . | |
RUN dotnet restore; dotnet publish -c Release | |
FROM microsoft/aspnetcore:2.0.0-nanoserver | |
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue'; $verbosePreference='Continue';"] |
This file contains 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
.UseHttpSys(options => | |
{ | |
options.Authentication.Schemes = AuthenticationSchemes.Negotiate | AuthenticationSchemes.NTLM; | |
options.Authentication.AllowAnonymous = true; | |
options.UrlPrefixes.Add("http://+:80/"); | |
}) |
This file contains 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
# escape=` | |
# Image with NET CORE installation to extract executables for final image | |
FROM microsoft/aspnetcore:2.0.0-nanoserver As CoreBuild | |
# Image with SDK to build .NET Core application from source | |
FROM microsoft/aspnetcore-build:2.0.0-nanoserver As builder | |
WORKDIR /source/ | |
COPY source/iis . |
This file contains 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
[Authorize(Roles = "Domain Admins")] | |
public IActionResult Windows() | |
{ | |
return Content ("You are " + User.Identity.Name + "; Authentication Type:" + User.Identity.AuthenticationType ); | |
} | |
[Authorize(Roles = "Domain Users")] | |
public IActionResult Users() | |
{ | |
return Content("You are " + User.Identity.Name + "; Authentication Type:" + User.Identity.AuthenticationType); | |
} |
This file contains 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 Program | |
{ | |
public static void Main(string[] args) | |
{ | |
BuildWebHost(args).Run(); | |
} | |
public static IWebHost BuildWebHost(string[] args) => | |
WebHost.CreateDefaultBuilder(args) | |
.UseIISIntegration() |
This file contains 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
services.Configure<IISOptions>(options => { | |
options.AutomaticAuthentication = true; | |
}); | |
services.AddAuthentication(Microsoft.AspNetCore.Server.IISIntegration.IISDefaults.AuthenticationScheme); | |
This file contains 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
# escape=` | |
# Image with NET CORE installation to extract executables for final image | |
FROM microsoft/aspnetcore:2.0.0-nanoserver As CoreBuild | |
# Middleware image used to extract ASP.NET core module | |
From microsoft/iis as WindowsBuild | |
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue'; $verbosePreference='Continue';"] | |
# Installing NET CORE webhosting in middleware image so latest module and configuration schema is extracted for final image | |
ADD https://download.microsoft.com/download/B/1/D/B1D7D5BF-3920-47AA-94BD-7A6E48822F18/DotNetCore.2.0.0-WindowsHosting.exe ".\hosting.exe" |
This file contains 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
Invoke-WebRequest "https://raw.githubusercontent.com/Microsoft/Virtualization-Documentation/live/windows-server-container-tools/ServiceAccounts/CredentialSpec.psm1" -UseBasicParsing -OutFile $env:TEMP\cred.psm1 | |
import-module $env:temp\cred.psm1 | |
New-CredentialSpec -Name win -AccountName containerhost | |
#This will return location and name of JSON file | |
Get-CredentialSpec | |
Name Path | |
---- ---- | |
win C:\ProgramData\docker\CredentialSpecs\win.json |
This file contains 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
Enable-WindowsOptionalFeature -FeatureName ActiveDirectory-Powershell -online -all | |
Get-ADServiceAccount -Identity containerhost | |
Install-ADServiceAccount -Identity containerhost | |
Test-AdServiceAccount -Identity containerhost |