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
$retries = 3 #$OctopusParameters['appPoolCheckRetries'] | |
$delay = 1000 #$OctopusParameters['appPoolCheckDelay'] | |
$counter = 1 | |
do { | |
try { | |
#Script Here | |
Break | |
} catch { | |
Write-Error $_.Exception.InnerException.Message -ErrorAction Continue | |
Write-Host "Attemp $counter failed." |
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
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"appServiceName": { | |
"type": "string", | |
"minLength": 1 | |
}, | |
"webAppName": { | |
"type": "string", |
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
$serviceAppUrl = $OctopusParameters["Stemp.LoginAppUrl"] | |
$servicePassword = $OctopusParameters["Stemp.LoginPassword"] | |
$serviceTenantId = $OctopusParameters["Stemp.LoginTenantID"] | |
$serviceSubscriptionId = $OctopusParameters["Stemp.LoginSubscriptionID"] | |
$cosmosResourceGroupName = $OctopusParameters["Stemp.CosmosResourceGroup"] | |
$cosmosName = $OctopusParameters["Stemp.CosmosName"] | |
$cosmosDatabaseName = $OctopusParameters["Stemp.CosmosDataBaseName"] | |
$cosmosCollectionName = $OctopusParameters["Stemp.CosmosCollectionName"] | |
# Login with Service Principal |
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
#Login-AzureRmAccount | |
#Set-AzureRmContext -SubscriptionName "" | |
$resourceGroupName = "" | |
$webAppName = "" | |
$functionName = "Authenticate" | |
$variableName = "masterKey" | |
function Get-PublishingProfileCredentials($resourceGroupName, $webAppName){ | |
$resourceType = "Microsoft.Web/sites/config" |
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
# Helper Funtions | |
function CatalogFolderDropContent($catalog, $folderName) | |
{ | |
if($catalog.Folders[$folderName] -eq $null){ | |
return; | |
} | |
while ($catalog.Folders[$folderName].Environments.Count -ne "0") | |
{ | |
$env = $catalog.Folders[$folderName].Environments | Select-Object -First 1 |
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
$resourcegroupname = "bsk-ml-eastus-rgroup-ops-01" | |
$allwebapps = "bsk-ml-eastus-api-webapp-ops-01, bsk-ml-eastus-audioextractor-webapp-ops-01" | |
$insightname = "bsk-ml-eastus-insights-ops-01" | |
#Removing Tags | |
$insight = Get-AzureRmResource -ResourceName $insightname -ResourceGroupName $resourcegroupname | |
$insight.tags = @{} | |
Set-AzureRmResource -Tag $insight.Tags -ResourceId $insight.ResourceId -Force | |
#Getting Resource Group ID |
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
# Clean old files | |
del composer_update_*.txt | |
# Start composer (we just let it timeout and redirect output and exit code to files) | |
composer update 1> composer_update_output.txt 2> composer_update_error.txt & echo %errorLevel% > composer_update_exitcode.txt | |
# Then we actively wait until exitcode file exist as a flag on execution end | |
if exist composer_update_exitcode.txt (echo exit) else (echo still running) | |
# Then we get the data from files |
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
#Setting up variables of our WebApp | |
$AzureWebSite = "MySite" | |
$SourceSlot = "staging" | |
$DestinationSlot = "production" | |
$AzureResourceGroup = "MyResourceGroup" | |
#Swapping | |
Switch-AzureRmWebAppSlot -SourceSlotName $SourceSlot -DestinationSlotName $DestinationSlot -ResourceGroupName $AzureResourceGroup -Name $AzureWebSite | |
#Getting Hybrid Connections from staging slot |
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
#Add-AzureRmAccount | |
#Get-AzureRmSubscription | |
#Set-AzureRmContext -SubscriptionName "" | |
$AzureWebSite = "" | |
$AzureResourceGroup = "" | |
$Resource = Get-AzureRmResource -ResourceType "microsoft.web/sites/config" -ResourceGroupName $AzureResourceGroup -ResourceName $AzureWebSite/web -ApiVersion "2016-08-01" | |
$Resource.Properties.virtualApplications[0].physicalPath = "site\wwwroot\" | |
$Resource | Set-AzureRmResource -Force -ApiVersion "2016-08-01" |
NewerOlder