Developer Blog

Tipps und Tricks für Entwickler und IT-Interessierte

Daily Azure: Migrate a Storge Account


Migration is done via azcopy:

  • download souce container to local folder
  • upload local folder to destination container

Get AzCopy

Here is the script install-azcopy.ps1:

# Download and extract

$URI = ""
$DST = "~\AppData\Local\Programs\AZCopy\"

Invoke-WebRequest -Uri $URI -OutFile -UseBasicParsing
Expand-Archive ./ ./AzCopy -Force

# Move AzCopy
mkdir ~\AppData\Local\Programs\AZCopy
Get-ChildItem ./AzCopy/*/azcopy.exe | Move-Item -Destination "~\$DEST"

# Add AzCopy to PATH
$userenv = (Get-ItemProperty -Path 'HKCU:\Environment' -Name Path).path
$newPath = "$userenv
New-ItemProperty -Path 'HKCU:\Environment' -Name Path -Value $newPath -Force

# Clean the kitchen
del -Force
del -Force -Recurse .\AzCopy\

Copy Folder

param (
    $FOLDER = "",

    [string]$TYPE   = "latest",


if ($TYPE -eq "latest") {
} else {

$SRC_ACCCOUNT = "<source storage account>";
$DST_ACCCOUNT = "<destination storage account>";

$SRC_CONTAINER = "<source container>"
$DST_CONTAINER = "<destination container>"


$TMP_FLDR     = "C:\TMP\Downloads"

Write-Host  "== Copy     '$FOLDER'"
Write-Host "       from  $SRC_URL"
Write-Host  "        to  $DST_URL"


if ($LOGIN) {
    $ENV:AZCOPY_CRED_TYPE = "OAuthToken";

    azcopy login

Write-Host  "== Download ======================================================"
Write-Host "       from  $SRC_URL"
Write-Host  "        to  $TMP_FLDR\$CONTAINER"

azcopy copy         $SRC_URL                                                                                      `
                    $TMP_FLDR                                                                                     `
                    --trusted-microsoft-suffixes=${SRC_ACCCOUNT}                            `
                    --overwrite=true                                                                              `
                    --check-md5=FailIfDifferent                                                                   `
                    --from-to=BlobLocal                                                                           `
                    --recursive                                                                                   `

# Upload
Write-Host  "== Upload   ======================================================"
Write-Host  "      from  $TMP_FLDR\$CONTAINER"
Write-Host  "        to  $DST_URL"

azcopy copy         $TMP_FLDR\$CONTAINER                         `
                    $DST_URL                                     `
                    --overwrite=true                             `
                    --from-to=LocalBlob                          `
                    --blob-type BlockBlob                        `
                    --follow-symlinks                            `
                    --check-length=true                          `
                    --put-md5                                    `
                    --follow-symlinks                            `
                    --disable-auto-decoding=false                `
                    --recursive                                  `

Call the script

First call should use -login to authenticate

.\copy.ps1 demo-folder-1 -login

Then, following commands dont need the login

.\copy.ps1 demo-folder-2

Daily: Running Microsoft SQL-Server in Docker


Using Docker is an effortless way to launch and run an application/server software without annoying installation hassles: Just run the image and you’re done.

Even if it’s quite an uncomplicated way of looking at it, in many cases it works just like that.

So, let’s start with using Microsoft SQL Server as a database backend. We will use a docker image from Microsoft. Look here to find out more.

docker	run                                       \
			--name mssql-server       \
			--memory 4294967296       \	
			-e "ACCEPT_EULA=Y"        \
			-e "SA_PASSWORD=secret"   \
			-p 1433:1433              \


Error: program requires a machine with at least 2000 megabytes of memory

Start the docker container as described on the Docker Hub Page: How to use this Image

❯ docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=secret" -p 1433:1433

Depending on how your docker environment is configured, this could bring up an error:

SQL Server 2019 will run as non-root by default.
This container is running as user mssql.
To learn more visit
sqlservr: This program requires a machine with at least 2000 megabytes of memory.
/opt/mssql/bin/sqlservr: This program requires a machine with at least 2000 megabytes of memory.

As the error message states, the MS SQL server needs at least 2g of RAM. So, you must assign your Docker VMs more memory. This is configured in the Docker Dashboard.

Hint: Docker has two ways of running containers:

  • using Windows Container
  • using WSL (Windows Subsystem for Linux)

You can change the way with the context menu of the docker symbol in the task bar:

With Linux Containers (using WSL as backend), you must configure the containers via a file .wslconfig.

This file is in the folder defined by the environment variable

To open the file, run the command:

From Command Promptnotepad

Edit the content and change the memory setting


Restart WSL with the new settings.

❯ wsl --shutdown

Start Container again, now everything should work

❯ docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=secret" -p 1433:1433

Daily: Build a Development Environment with Docker and VS Code


Working with different software (samples, compilers, demos) always requires an adequate environment.

Because i don’t want to pollute my normal environment (my running PC), i decided to use a virtual environment with Docker.

Luckily, VS Code supports this by using remote containers and working fully within these containers.

The Files


	"name": "Prolog Environment",

	"dockerComposeFile": [

	"service": "app",
	"workspaceFolder": "/workspace",

	"settings": {},
	"extensions": []


version: '3.8'
        context: .
        dockerfile: Dockerfile

    container_name: pws_prolog

        - ../workspace:/workspace:cached

    # Overrides default command so things don't shut down after the process ends.
    command: /bin/sh -c "while sleep 1000; do :; done"


# STAGE 1:
FROM ubuntu:latest as base_nodejs

# Configure Timezone
ENV TZ 'Europe/Berlin'

RUN echo $TZ > /etc/timezone 

RUN    apt-get update \
    && apt-get install -y tzdata \
    && rm /etc/localtime \
    && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
    && dpkg-reconfigure -f noninteractive tzdata \
    && apt-get clean

RUN apt-get install --yes build-essential curl sudo git vim

# Create user
RUN    groupadd work -g 1000 \
    && adduser user --uid 1000 --gid 1000 --home /workspace --disabled-password --gecos User

# Setup sudo
RUN echo 

# Install Prolog
RUN  apt-get -y install swi-prolog

USER user

VOLUME [ "/workspace" ]
WORKDIR /workspace

CMD ["/bin/bash"]

The Explanation

Copyright © 2024 | Powered by WordPress | Aasta Blog theme by ThemeArile