Skip to content

Instantly share code, notes, and snippets.

View goyalmohit's full-sized avatar

mohit goyal goyalmohit

View GitHub Profile
@goyalmohit
goyalmohit / maps-krestel-with-ssl-certificate
Created September 23, 2018 09:23
Dockerfile Sample for Mapping Krestel with SSL Certificate
...
ENV ASPNETCORE_URLS="https://+;http://+"
ENV ASPNETCORE_Kestrel__Certificates__Default__Password="YourSecurePassword"
ENV ASPNETCORE_Kestrel__Certificates__Default__Path="my_web_domain.pfx"
...
<PropertyGroup>
<!-- other properties here -->
<!-- SonarQube needs this -->
<ProjectGuid>{6224c484-3e23-4f06-a749-195c1e478110}</ProjectGuid>
</PropertyGroup>
$cosmosServer = "mycosmos.documents.azure.com:10255" #Define the cosmos db hostname and port
$cosmosUser = "mycosmos-username" #Define username
$cosmosPassword = "mycosmos-password" #Defines password
$backupDir = "C:\cosmos-backup\$(Get-Date -Format yyyyMMddhhmmss)"
if(!(Test-Path $backupDir)){
Write-Host "Creating temporary backup directory as $backupDir"
New-Item -Path $backupDir -ItemType Directory | Out-Null
}
Set-Location $backupDir
// Adds Web Site
{
"name": "[variables('webAppNameVar')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"kind": "apiApp",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('appHostingPlanName'))]"
],
# Deletes files from Azure Blob Storage
$blobList = Get-AzureStorageBlob -Container $containerName -Context $strContext | Where-Object {$_.LastModified -le ($(Get-Date).AddMinutes(-1))}
foreach($blob in $blobList){
Write-Host "Removing blob $($blob.Name)"
Remove-AzureStorageBlob -Blob $($blob.Name) -Container $containerName -Context $strContext
}
# Uploads file to Azure Container without preserving file hierarchy
$localDir = "C:\Source\ConsoleApp01"
foreach($file in (Get-ChildItem $localDir -File -Recurse)){
Set-AzureStorageBlobContent -Blob $($file.Name) -Container $containerName -File $($file.FullName) -Context $strcontext
}
# Uploads file to Azure Container with preserving file hierarchy
$localDir = "C:\Source\ConsoleApp01"
# Creates Azure Blob Storage Container
$strAccountKey = "yztbMxxxxxxxxxxxxxxxxx" # Replace this with your storage key
$strContext = New-AzureStorageContext -StorageAccountName $strAccountName -StorageAccountKey $strAccountKey
$containerName = "testfiles"
New-AzureStorageContainer -Name $containerName -Context $strcontext
# Create General Purpose Azure Storage Account
$strAccountName = "mobinotifysa"
$locationName = "east us"
$sku = "Standard_LRS"
New-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -AccountName $strAccountName -SkuName $sku -Location $locationNam
@goyalmohit
goyalmohit / CreateAzureResourceGroup.ps1
Created January 26, 2018 11:29
Create an azure resource Group
# Creates an azure resource group
$resourceGroupName = "mobiNotify-rg"
$locationName = "east us"
New-AzureRmResourceGroup -Name $resourceGroupName -Location $locationName
@goyalmohit
goyalmohit / understanding-msbuild-use-condition-with-property
Created December 4, 2017 11:27
Understanding MSBuild Properties - Use conditions to define default values
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>