NuGet provider is required to continue PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'D:\Program Files\PackageManagement\ProviderAssemblies' or 'D:\Users\jacky\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y PS D:\Users\jacky>
** Step2. Install-Module Convert-Etl2Pcapng -Force -AcceptLicense ** Close PowerShell PowerShell Run a Administrator
PS D:\demo> netsh trace start capture=yes tracefile=D:\demo\trace.etl report=dis File "D:\demo\trace.etl" already exists. One or more parameters for the command are not correct or missing. See 'trace start help' for detailed help.
Bing Wallpaper includes a collection of beautiful images from around the world that have been featured on the Bing homepage. Not only will you see a new image on your desktop each day, but you can also browse images and learn where they’re from. https://go.microsoft.com/fwlink/?linkid=2128969
This collection supports the Channel9/YouTube series called Developer’s Intro to Data Science. This series will target professional developers who are new to Data Science, Machine Learning, and AI.
In Solution Explorer, under Roles in your cloud service project, right-click your web role and select Add > New Folder. Create a folder named bin. Right-click the bin folder and select Add > Existing Item. Select the files and add it to the bin folder. To add the files for a worker role:
Right-click your worker role and select Add > Existing Item. Select the files and add it to the role. When files are added in this way to the role content folder, they’re automatically added to your cloud service package. The files are then deployed to a consistent location on the virtual machine. Repeat this process for each web and worker role in your cloud service so that all roles have a copy of the installer.
Step 1: Create the PowerShell script to enable cipher suite, “TLS_DHE_RSA_WITH_AES_256_GCM_SHA384”. Use the following code as an example to create a script that enables the cipher suites. For the purposes of this documentation, this script will be named: TLSsettings.ps1. Store this script on your local desktop for easy access in later steps.
# You can use the -SetCipherOrder (or -sco) option to also set the TLS cipher # suite order. Change the cipherorder variable below to the order you want to set on the # server. Setting this requires a reboot to take effect.
# Check for existence of registry key, and create if it does not exist If (!(Test-Path-Path$regkeys[$keyindex])) { New-Item$regkeys[$keyindex] | Out-Null }
# Get data of registry value, or null if it does not exist $val = (Get-ItemProperty-Path$regkeys[$keyindex] -Name$value-ErrorAction SilentlyContinue).$value
If ($null-eq$val) { # Value does not exist - create and set to desired value New-ItemProperty-Path$regkeys[$keyindex] -Name$value-Value$valuedata-PropertyType$valuetype | Out-Null $restart = $True Write-Host"Configuring $regkeys[$keyindex]...."
} Else {
# Value does exist - if not equal to desired value, change it If ($val-ne$valuedata) { Set-ItemProperty-Path$regkeys[$keyindex] -Name$value-Value$valuedata $restart = $True Write-Host"Configuring $regkeys[$keyindex]..." } }
if ([System.String]::Join(';', $val) -ne [System.String]::Join(';', $desiredOrder)) { Write-Host"The original curve order ", `n, $val, `n, "needs to be updated to ", $desiredOrder Set-ItemProperty-Path$regkeys[15] -Name EccCurves -Value$desiredOrder $reboot = $True } } }
$reboot
}
If ([Environment]::OSVersion.Version.Major -lt10) { # This is for Windows before 10 Write-Host"Configuring Windows before 10..." $cipherorder = "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384," $cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_P384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_P256," $cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384_P384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256_P256," $cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256," $cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256," $cipherorder += "TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256," $cipherorder += "TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256," $cipherorder += "TLS_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA"
} Else {
# this is for windows 10 or above Write-Host"Configuring Windows 10+..." $cipherorder = "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384," $cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256," $cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256," $cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256," $cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256," $cipherorder += "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA," $cipherorder += "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA," $cipherorder += "TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256," $cipherorder += "TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256," $cipherorder += "TLS_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA" }
# If any settings are changed, this will change to $True and the server will reboot $reboot = $False
# Check for existence of registry keys (SSL 2.0, SSL 3.0, TLS 1.0, TLS 1.1, TLS 1.2), and create if they do not exist For ($i = 0; $i-le14; $i = $i + 1) { If (!(Test-Path-Path$regkeys[$i])) { New-Item$regkeys[$i] | Out-Null } }
if ($val-ne$cipherorder) { Write-Host"The original cipher suite order needs to be updated", `n, $val Set-ItemProperty-Path$regkeys[15] -Name Functions -Value$cipherorder $reboot = $True } # }
$reboot = Set-Windows10PlusCurveOrder$reboot
If ($reboot) { # Randomize the reboot timing since it could be run in a large cluster. $tick = [System.Int32]([System.DateTime]::Now.Ticks % [System.Int32]::MaxValue) $rand = [System.Random]::new($tick) #$sec = $rand.Next(30, 600) $sec = 30 Write-Host"Rebooting after", $sec, " second(s)..." Write-Host"shutdown.exe /r /t $sec /c ""Crypto settings changed"" /f /d p:2:4" shutdown.exe /r /t $sec /c "Crypto settings changed" /f /d p:2:4
} Else {
Write-Host"Nothing get updated." }
Step 2: Create a command file Create a CMD file named RunTLSSettings.cmd using the below. Store this script on your local desktop for easy access in later steps.
1 2 3 4
echo "Invoking TLSsettings.ps1 on Azure service at%TIME% on %DATE%" >> %TEMP%\StartupLog.txt 2>&1 PowerShell -ExecutionPolicy Unrestricted .\TLSsettings.ps1 -sco >> %TEMP%\StartupLog.txt 2>&1
EXIT /B %ERRORLEVEL%
Step 3: Add the startup task to the role’s service definition (csdef)
Create resource group (Only run it one time) az group create –name “JACKY-RG-TEST” –location “westus”
Create App Service Plan (Only run it one time) az appservice plan create –name “jacky-test” –resource-group “JACKY-RG-TEST” –sku S1 –is-linux
Create Web app (Only run it one time) az webapp create –resource-group “JACKY-RG-TEST” –plan “jacky-test” –name “jacky-jacky2” –runtime “PYTHON|3.6”
Set application settings SCM_DO_BUILD_DURING_DEPLOYMENT=true az webapp config appsettings set -g “JACKY-RG-TEST” -n “jacky-test” –settings SCM_DO_BUILD_DURING_DEPLOYMENT=true
Deploy a ZIP file to the webapp az webapp deployment source config-zip –resource-group “JACKY-RG-TEST” –name “jacky-jacky2” –src “C:\temp\application.zip”
Modfiy codes and redeploy a zip to the same webapp az webapp deployment source config-zip –resource-group “JACKY-RG-TEST” –name “jacky-jacky2” –src “C:\temp\applicationv2.zip”
Go to Azure Portal, then go to “Azure Active Directory” Section. In the “App registrations” section, click on “New application registration”
Specify the “Name” and “Sign-on URL”(It does not have to be the real one but required.). For “Application Type” must be “Web app/ API” in order to generate the client secret for the app.
Once its finish, you’ll see the “Application ID”. This will be your Client Id.
Next, click on “Settings” button as shown in the figure below. Go to “Keys” section. Then specify the description and choose the expires and your password in “VALUE” . Finally, click on “Save” button
The secret string will be shown once the saving is complete. This will be the “Client Secret” for the App.
Go to your Azure Key Vault. Then, go to “Access Policies” section. Next, Click on “Add New”.
In the “Configure from template” option choose “Key, Secret, & Certificate Management”. Next, “Select Principal” choose the app that was created in the Active Directory.
Step 4: Client Implementation
1 2 3 4
var context = new Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext(@"https://login.windows.net/Your Tenant"); ClientCredential clientCredential = new ClientCredential("Your Client Id from step 3.3", "Your secret from step 3.5"); var tokenResponse = context.AcquireTokenAsync("https://**vault.azure.net**", clientCredential); var accessToken = tokenResponse.Result.AccessToken;
It’s often not practical in a real-world cloud app to avoid storing some form of state for a user session, but some approaches impact performance and scalability more than others. If you have to store state, the best solution is to keep the amount of state small and store it in cookies. If that isn’t feasible, the next best solution is to use session state with a provider for distributed, in-memory cache.
Azure Cache for Redis provides a session state provider that you can use to store your session state in-memory with Azure Cache for Redis instead of a SQL Server database.