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
import os, uuid | |
from azure.identity import DefaultAzureCredential | |
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient | |
connection_string = "CONNECTION_STRING" | |
service = BlobServiceClient.from_connection_string(connection_string) | |
try: | |
account_info = service.get_account_information() | |
print('Using Storage SKU: {}'.format(account_info['sku_name'])) |
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
$folder_for_cleanup = "R:\files\incremental" | |
Get-ChildItem $folder_for_cleanup | Sort -Property FullName | ForEach-Object { | |
Write-Host restoring $_.FullName | |
sqlcmd -Q "RESTORE LOG [Database_Name] FROM DISK=N'$_' WITH NORECOVERY" -o R:\files\results\incrementalresult.txt; #writing a log output | |
[string]$result = Get-Content R:\files\results\incrementalresult.txt | |
if ($result.contains('terminates')) { | |
Write-Host backup is already present in the database, skipping ... | |
Remove-Item $_.FullName -Force -Confirm:$false | |
} | |
else { |
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
trigger: | |
- none | |
pool: | |
vmImage: windows-latest | |
steps: | |
- task: VSBuild@1 | |
displayName: Build appservice |
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
trigger: none | |
pr: none | |
pool: | |
vmImage: windows-latest | |
parameters: | |
- name: backupfile | |
type: string | |
jobs: |
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
- task: AzureCLI@2 | |
displayName: az cli stop command | |
inputs: | |
azureSubscription: 'YOURSUB' | |
scriptType: 'pscore' | |
scriptLocation: 'inlineScript' | |
inlineScript: | | |
$token = az account get-access-token | ConvertFrom-Json | |
$mytoken = $token.accesstoken | |
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
trigger: none | |
pr: none | |
parameters: | |
- name: vms | |
type: object | |
default: ["ubuntu1","windows-1"] | |
pool: | |
vmImage: ubuntu-latest |
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
$container_name_input = "backups" | |
$sg_con_string = "XXX" | |
$json = az storage blob list --container-name $container_name_input --connection-string $sg_con_string | ConvertFrom-Json | Sort-Object -Descending { $_.properties.CreationTime } | Select-Object name | |
az storage blob download --file $json[0].name --name $json[0].name --container-name $container_name_input --connection-string $sg_con_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
trigger: | |
- none | |
pr: none | |
pool: | |
vmImage: ubuntu-latest | |
variables: | |
- group: token-group |
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
trigger: | |
- none | |
pr: none | |
parameters: | |
- name: containerlist | |
type: object | |
default: ["core/image1","core/image2","core/image3","core/image4"] |
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; | |
using System.Threading.Tasks; | |
using System.Configuration; | |
using System.Collections.Generic; | |
using System.Net; | |
using System.Timers; | |
using Azure.Storage.Blobs; | |
using Azure.Storage.Blobs.Models; | |
using System; | |
using System.IO; |
NewerOlder