Wiedza
  • 0 Koszyk
  • Kontakt
  • Moje konto
  • Blog
  • MOC On-Demand – co to takiego?
  • MOC On-Demand – Co zyskujesz?
  • Kursy MS

Hybrid Configuration Office 365, Google G-Suite, Exchange OnPrem

Hybrid Configuration Office 365, Google G-Suite, Exchange OnPrem

 

Mail flow Idea:

 

Gmail configuration:

 

 

Exchange On Prem Configuration:

 

There could be also (especially with not all emails synced):

  1. Outgoing Connector to Office 365 with scope @onmicrosoft.com
  2. Outgoing Connector to Google G-Suite with scope @domain.pl

 

Office 365 Connectors Configuration:

 

 

 

Errror mkdir /host_mnt/c: file exists

W przypadku wystąpienia błędu przy startowaniu kontenerów za pomocą docker start lub docker-compose up / docker-compose start zwłaszcza w przypadku Windows należy zrestartować serwis docker’a lub jeszcze lepiej zrestartować cały komputer.


If you receive error like this:

Errror mkdir /host_mnt/c: file exists

Please restart docker service or just restart computer.

Polityka haseł jaka powinna być / Password Policy – na podstawie / based on Azure Identity Secure Score

W czasie Ignite 2018 Microsoft wprowadził Identity Secure Score dostępną w panelu Azure Active Directory. Oprogramowanie informuje nas ile punktów od 1 do 248 zebraliśmy, za prawidłową i bezpieczną konfigurację usług dostępnych w chmurze Microsoft. Dodatkowo widzimy, ile i za co dodatkowych punktów możemy zdobyć. Wszyscy lubimy się porównywać, dlatego też mamy informacje, czy nasz wynik jest powyżej średniej, czy poniżej w sektorze gospodarki.

Poniżej screen wraz z kilkoma wskazówkami dotyczącymi ulepszeń. Po kliknięciu w każde z nich dostajemy dokładną informację co powinniśmy wykonać.

Często dyskutujemy, jak często powinniśmy zmieniać hasła, oraz czy wymuszać je polityką – tutaj wyjaśnienia Microsoft:

Do not expire passwords – Research has found that when periodic password resets are enforced, passwords become less secure. Users tend to pick a weaker password and vary it slightly for each reset. If a user creates a strong password (long, complex and without any pragmatic words present) it should remain just as strong in 60 days as it is today. It is Microsoft’s official security position to not expire passwords periodically without a specific reason. Your current policy is set to require a password reset every 999 days.

What am I about to change? – Under Security & privacy, edit the Password Policy to never let passwords expire. You must be a global admin to edit the password policy.

How will it affect my users? – Your users will no longer need to periodically create new passwords.

Oczywiście wśród zaleceń mamy również zlecenia do włączenia MFA.

Następna polityka to:

Delete/block accounts not used in last 30 days – Deleting or blocking accounts that haven’t been used in the last 30 days, after checking with owners, helps prevent unauthorized use of inactive accounts. These accounts can be targets for attackers who are looking to find ways to access your data without being noticed.

What am I about to change? – Clicking the button below will take you to GitHub where you can download a Powershell script to look up the users who have not logged in for the last 90 days.

Jako odpowiedź na poniższy wpis tutaj link do źródła – polecam zapoznać się (THX- John Flores).


During Ignite 2018 Microsoft introduced Identity Secure Score available in the Azure Active Directory panel. Functionality informs us how many points from 1 to 248 we collected for the correct and safe configuration of services available in the Microsoft cloud. In addition, we see how much and for what we can get additional points. We all like to compare, that’s why we have information if our result is above or below the average.

Below the screen with some tips for improvements. After clicking on each of them, we get the exact information what should we do.

We often discuss how often we should change passwords and whether to force them through GPO or similar- here Microsoft’s explanations:

Do not expire passwords – Research has found that when periodic password resets are enforced, passwords become less secure. Users tend to pick a weaker password and vary it for each reset. If a user creates a strong password (long, complex and without any pragmatic words present) it should remain just like today. It is Microsoft’s official security position. Your current policy is set to require a reset every 999 days.

What am I about to change? – Under Security & privacy, edit the passwords expire. You must be the global admin to edit the password policy.

How will it affect my users? – Your users will need to periodically create new passwords.

Of course, among the recommendations we also have orders to include MFA.

The next policy is:

Delete/block accounts not used in last 30 days – Deleting or blocking accounts that haven’t been used in the last 30 days, after checking with owners, helps prevent unauthorized use of inactive accounts. These accounts can be targets for attackers who are looking to find ways to access your data without being noticed.

What am I about to change? – Clicking the button below will take you to GitHub where you can download a Powershell script to look up the users who have not logged in for the last 90 days.

Here is a MS sorce document (THX- John Flores).

AWS – Disk / VM Export

Czasami potrzebujemy przenieść maszynę wirtualną znajdującą się w chmurze do innego providera chmury, lub wręcz do on-prem. Chociażby po-to, aby mieć backup. O ile w Microsoft Azure sprawa jest banalnie proste – mamy opcje Disk Export i to nawet z GUI. O tyle w przypadku AWS, musimy skorzystać z CLI, za pomocą komendy:

aws ec2 create-instance-export-task –instance-id i-0fe640735a4f8f09b –target-environment microsoft –export-to-s3-task DiskImageFormat=vhd,ContainerFormat=ova,S3Bucket=psensedata,S3Prefix=prefix

Oczywiście wcześniej musimy utworzyć Storage S3 i nadać uprawnienia (The destination bucket must exist and grant WRITE and READ_ACP permissions to the AWS account vm-import-export@amazon.com).

I tutaj możemy spotkać małą niespodziankę, ponieważ może się zdarzyć, iż otrzymamy komunikat:

An error occurred (NotExportable) when calling the CreateInstanceExportTask operation: Only certain instances can be exported. See VM Export documentation for details.

W przypadku Amazon możemy exportować tylko dyski, które wcześniej były zaimportowane do chmury AWS.

Jak sobie poradzić z problemem?

  1. Utworzyć nowy dysk i podłączyć do maszyny wirtualnej
  2. Wykonać kopie sektor po sektorze w przypadku Windows, za pomocą oprogramowania Disk2VHD (omawiane dokładnie tutaj), natomiast w przypadku Linux za pomocą np. dd.
  3. Odegrać tak stworzony image
  4. Zaimportować wspomniany Image (raw) i wyeksportować do jakiegoś bardziej strawnego formatu.

A jak to wykonać po kolei?

Instalujemy AWS CLI i od razu konfigurujemy wydając komendę:

aws configure

AWS Access Key ID oraz AWS Secret Access Key tworzymy na koncie uzytkownika https://console.aws.amazon.com/iam/home#/users w zakładce Security Credentials.

I następnie, wykonujemy komendy – wyświetlenie istniejących instancji typu compute:

aws ec2 describe-instances

Utworzenie nowego dysku o wielkości 32 GB:

aws ec2 create-volume –-size 32 –-region us-east-2 –-availability-zone us-east-2b –-volume-type gp2

Wyświetlenie dysku:

aws ec2 describe-volumes

Przypisanie dysku do instancji:

aws ec2 attach-volume –-volume-id vol-049ddd01841d8c8e4 –-instance-id i-0fe640735a4f8f09b –-device /dev/sdf

Oczywiście volume-id oraz instance-id jest odpowiednio wcześniej odczytane.

Teraz już logujemy się do maszyny wirtualnej i wykonujemy kontrolny restart, a następnie tworzymy partycje, zakładamy filesystem i montujemy (przykład freebsd – dla linux tylko prościej):

geom disk list

gpart show -l

gpart create -s GPT xbd5

gpart add -t freebsd-ufs xbd5

newfs -U /dev/xbd5p1

mount /dev/xbd5p1 /mnt

I wykonujemy kopie sektor po sektorze:

dd if=/dev/ada0 of=/mnt/disk.img

Aby nieco przyspieszyć możemy dodać bs=100M.

Tak przygotowany image musimy dostosować, do bardziej strawnego formatu, aby się z niego zabootować – i tutaj korzystamy albo z Open Stack, albo z VirtualBox.

Poniżej screenshot z uruchomionej instancji pfSense na lokalnym Oracle VirtualBox, z wcześniej wyeksportowanego w wyżej wymieniony sposób dysku.

Import dysku możliwy jest po wykonaniu komendy:

vboxmanage internalcommands createrawvmdk -filename “disk.vmdk” -rawdisk “disk.raw”

Inna opcja migracji z AWS to użycie Azure Site Recovery (co nie raz było omawiane, ale tylko dla wspieranych systemów operacyjnych i nie freebsd) lub nietestowanego jeszcze przeze mnie rozwiązania w AWS typu https://vmplace.eu/Image/azurezilla—physical-virtual-to-azure-converter.

Sometimes we need to move a virtual machine located in the cloud to another cloud provider, or even to on-prem (e.g. for a backup purpose). In Microsoft Azure it is very simple – we have Disk Export in GUI too. In the case of AWS, we need to use the CLI, using the command:

aws ec2 create-instance-export-task –instance-id i-0fe640735a4f8f09b –target-environment microsoft –export-to-s3-task DiskImageFormat=vhd,ContainerFormat=ova,S3Bucket=psensedata,S3Prefix=prefix

Oczywiście wcześniej musimy utworzyć Storage S3 i nadać uprawnienia (The destination bucket must exist and grant WRITE and READ_ACP permissions to the AWS account vm-import-export@amazon.com).

Here we can meet a small surprise, because it may happen that we receive a message:

An error occurred (NotExportable) when calling the CreateInstanceExportTask operation: Only certain instances can be exported. See VM Export documentation for details.

In the case of Amazon, we can only export disks that were previously imported to the AWS cloud.

How to deal with the problem?

  1. Create a new disk and connect to the virtual machine
  2. Make a sector-by-sector copy (for Windows using Disk2VHD), and for Linux, for example, dd.
  3. Copy a created image
  4. Import the mentioned Image (raw) and export to some more digestible format.

Step by Step:

Install AWS CLI and configure it using:

aws configure

AWS Access Key ID and AWS Secret Access Key can be created on the user’s account page https://console.aws.amazon.com/iam/home#/users at the Security Credentials tab.

Next run command to display compute instances:

aws ec2 describe-instances

Create new 32 GB disk:

aws ec2 create-volume –-size 32 –-region us-east-2 –-availability-zone us-east-2b –-volume-type gp2

Display Disk:

aws ec2 describe-volumes

Assign disk to the instance:

aws ec2 attach-volume –-volume-id vol-049ddd01841d8c8e4 –-instance-id i-0fe640735a4f8f09b –-device /dev/sdf

Of course, volume-id and instance-id should be taken from above commands.

Now we can log in to the virtual machine and perform a control restart, then we create partitions, create filesystem and mount it (example freebsd – for linux it is simpler):

geom disk list

gpart show -l

gpart create -s GPT xbd5

gpart add -t freebsd-ufs xbd5

newfs -U /dev/xbd5p1

mount /dev/xbd5p1 /mnt

And make sector by sector copy:

dd if=/dev/ada0 of=/mnt/disk.img

We can add bs=100M to speed up the process.

This image we can upload to Open Stack or use it with Virtual Box. Disk import can be done after:

vboxmanage internalcommands createrawvmdk -filename “disk.vmdk” -rawdisk “disk.raw”

Another option of migrating from AWS is the use of Azure Site Recovery (which has been discussed more than once, but only for supported operating systems and not freebsd) or use untested solution in AWS like https://vmplace.eu/Image/azurezilla—physical-virtual-to-azure-converter.

Ściąganie plików za pomocą PowrShela, How to download file using PowerShell:

Invoke-WebRequest -Uri $url -OutFile $output #wolne, ale z progress barem / slow but with progressbar

(New-Object System.Net.WebClient).DownloadFile($url, $output) # szybkie, ale bez progras baru / fast, but without progress bar

Start-BitsTransfer -Source $url -Destination $output # szybkie, z progress barem, ale BITS musi być uruchomiony i jak coś jest w kolejce to będziemy czekać. Jest tryb asynchroniczny / Fast with progress bar, but bits should be working

A swoją drogą najszybsze rezultaty pod względem szybkości osiągamy starymi dobrymi Acceleratorami, które były używane za czasów modemów – mój ulubiony: http://www.internetdownloadmanager.com/

Windows 10 i Windows 2019 – Linux LCOW Containers coexist with Windows Containers – Azure App Service Container Support

Konteneryzacja w systemach Windows Server po raz pierwszy była pokazywana na konferencji Microsoft Build w 2016 roku – co ciekawie wtedy do takiego kontenera (windowsowego) można było połączyć się po RDP i wszystkie operacje wykonywać nie za pomocą polecenia docker, a za pomocą PowerShell! Jeszcze w tym samym roku mogliśmy sami dotykać kontenerów w Windows 10, co pokazywałem w ramach relacji z Ignite 2016 – polecam Channel9.

Jak dzisiaj wygląda świat kontenerów w Windows 10 i Windows Server 2019. Zakładam, że mamy w miarę nową wersje systemu Windows (poniższe wykonywane na wersji Windows 10 1809) musimy zainstalować docker’a – najlepiej z oficjalnej strony. Docker instaluje się jako serwis i przy zegarku możemy zobaczyć jego status, gdzie po raz pierwszy zobaczymy informacje (zakładam, iż nie mamy wymienionych komponentów zainstalowanych):

Po wciśnięciu OK zainstalują się komponenty kontenerów oraz Hyper-V. Możemy wydać kilka komend aby uruchomić kontener i tak np.:

docker run -it busybox         #uruchomienie obrazu mini dystrybucji linuxa w trybie interaktywnym

ls

exit

dosker ps -a             #wyświetlenie wszystkich kontenerów także zatrzymanych

docker start id_kontenera     #uruchomienie kontenera

docker ps             #wyświetlenie uruchomionych kontenerów

Jak to możliwe, że linuxa uruchamiamy z pod Windows – a po prostu działa poniższy mechanizm:

Czyli pod spodem działa nam maszyna wirtualna MobyLinux, którą zresztą możemy podejrzeć w Hyper-V:

Jeżeli teraz chcemy uruchomić kontener Windows i wykonamy komendę:

docker run -it -d –name nano microsoft/nanoserver:1709

otrzymamy błąd:

docker: image operating system “windows” cannot be used on this platform.

No właśnie, do tej pory nie mogliśmy jednocześnie uruchamiać kontenerów Windows’owych razem z Linux’owymi, a musieliśmy się między nimi przełączać – prawy przycisk na wielorybie i wybieramy Switch to Windows containers…

Kontenery Windows mogą w systemach serwerowych działać w trybie natywnym lub w trybie Izolacji Hyper-V. W Windows 10 tylko i wyłącznie w trybie izolacji Hyper-V. W tym momencie możemy już uruchomić np. IIS w kontenerze Nano Serwer, poleceniem:

docker run -it -d –name nano microsoft/nanoserver:1709

Od wersji Docker for Windows 17.11 z Windows 10 1809, możemy również w trybie izolacji Hyper-V, uruchamiać kontenery Linuxow’owe wraz z kontenerami Windowsowymi, które to działają jednocześnie. Aby to zrobić należy włączyć tryb eksperymentalny w Docker’ze:

Od tego momentu możemy uruchamiać i kontenery Linux’owe i Windows’owe:

docker run -it -d –name nano2 microsoft/nanoserver:1709

docker run -d –name httpd2 -p 8080:80 httpd

Jak to działa:

Kontenery LCOW, działają w ramach minimalnej dystrybucji linux’a – LinuxKit (ciągle w trybie rozwoju).

Wkrótce przedstawię kilka zastosowań praktycznych kontenerów, obecnie warto zapoznać się z moim artykułem Jak rozpoznać i debugować aplikacje działającą w Windows Container.

Jeżeli chodzi o Microsoft Azure, to kontenery Linux’owe mogą zostać uruchomione na kilka rodzajów, na Ignite 2018 pobawiłem się w trybie nadzorowanym kontenerami Windowsowymi w ramach Web App (obecnie public preview), jak niżej:

Jeżeli chodzi o AWS – to tutaj mamy obecnie troszkę większe możliwości:


The first time that the containerization for the Windows Server systems was shown at the Microsoft Build Conference in 2016 year. What was interesting – it was possible to connect to container via RDP connection and all operations was performed not by a docker command, but using PowerShell! In the same year, we were able to touch the containers in Windows 10, which I showed in the context of the relation from Ignite and we can still watch in at the Channel9.

How today the world of containers looks like in Windows 10 and Windows Server 2019. We need to install a docker (https://www.docker.com/products/docker-desktop). I am using Windows 10 1809 for this screenshots. Docker installs as a service and we can see its status on behind the clock. For the first time we see this screen:

After pressing OK, container components and Hyper-V will be installed. We can issue a few commands to start the container, for an example:

docker run -it busybox         #launching the linux mini distribution image in interactive mode

ls

exit

dosker ps -a                            # displaying all containers (also stopped)

docker start icontainer_id  #start container

docker ps                                 # display of started containers

How is it possible that we run linux under Windows – see this:

So underneath we have a MobyLinux virtual machine, which can be seen in Hyper-V:

If you now want to start Windows container and execute the command:

docker run -it -d –name nano microsoft/nanoserver:1709

we receive:

docker: image operating system “windows” cannot be used on this platform.

Until today we have not been able to run Windows containers together with Linux at the same time, and we had to switch between them – the right button on the whale and choose Switch to Windows containers…

Windows containers can run on server systems in native mode or in Hyper-V isolation mode. On Windows 10, only in Hyper-V isolation mode. Let’s try to run Windows IIS container:

docker run -it -d –name nano microsoft/nanoserver:1709

Since Docker for Windows 17.11 with Windows 10 1809, we can also run Linux containers with Windows containers that work simultaneously in Hyper-V isolation mode. To do this, enable the experimental mode:

From that moment, we can run Linux and Windows containers:

docker run -it -d –name nano2 microsoft/nanoserver:1709

docker run -d –name httpd2 -p 8080:80 httpd

How is it works:

LCOW containers operate as part of the minimal linux distribution – LinuxKit (under development).

I will soon introduce some practical applications of containers, so stay tuned.

In Microsoft Azure Linux containers can be run on several ways, on Ignite 2018 I played in supervised mode with Windows containers as part of the Web App (currently public preview), as below:

According to the AWS – here we have a bit more possibilities:

Literatura / Literature:

https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/linux-containers

https://forums.docker.com/t/linux-container-in-w2k16/26321/3

https://azure.microsoft.com/pl-pl/blog/announcing-the-public-preview-of-windows-container-support-in-azure-app-service/

https://rzetelnekursy.pl/jak-rozpoznac-i-debugowac-aplikacje-dzialajaca-w-windows-container-how-to-recognize-and-debug-applications-running-in-windows-container/

https://github.com/linuxkit/linuxkit

Dostrajanie Failover Cluster dla Hyper-V i nie tylko

W poprzednim artykule ogarnęliśmy ruch między węzłowy, a w szczególności CSV. Tym razem zajmiemy się podkręceniem Clustra, aby działał jak najbardziej niezawodnie.

Błąd typu Operating System failure (Windows bug check, STOP: 0x0000009E (blue screen).

Czasami się zdarza się, że usługa Cluster przez chwile nie odpowiada, a my nie lubimy blue-screenów i aby zapobiec błędom STOP w przypadku braku odpowiedzi usługi Cluster należy wykonać:

(Get-Cluster).HangRecoveryAction=1

Inne parametry to:

0 = Wyłączenie mechanizmu
1 = Logowanie zdarzenia
2 = Zatrzymanie usługi Cluster
3 = Wygenerowanie błędu Stop STOP: 0x0000009E

Idąc dalej podobne ustawienia należy wykonać dla dysków Clustrowych.

Basic check – to tzw. Podstawowy (LooksAlive Health Check) – kiedy zostanie wykonany i zwrócona zostanie wartość True – oznacza, że dysk “powinien działać”

Bardziej Zaawansowany test to Thorough check (IsAlive), wykonywany co określony czas oraz jeżeli test podstawowy zwrócił błąd.

W przypadku bardziej obciążonego systemu warto te czasy wydłużyć, co pozwoli uniknąć błędów zwłaszcza podczas backupu, objawiających się tym iż maszyna wirtualna straciła połączenie do dysku.

LooksAlive: By default, a brief check is performed every 5 seconds to verify that a disk is still available. The LooksAlive check determines whether a resource flag is set. This flag indicates that a device has failed. For example, a flag may indicate that periodic reservation has failed. The frequency of this check is user definable.

IsAlive: A complete check is performed every 60 seconds to verify that the disk and the file system can be accessed. The IsAlive check effectively performs the same functionality as a “dir” command that you type at a command prompt. The actual command it uses is the “FindFirstFile()” API. The frequency of this check is also user definable.

Podobnie jak ustawienia dotyczące dostępnego komponentu, takiego jak dysk mamy też ustawienia dot. poszczególnych zasobów. I tak dla maszyn wirtualnych, aby w przypadku obciążenia za szybko nie były uznawane, za niedziałające proponuje ustawić następujący parametr.

(Get-ClusterResourceType “Virtual Machine”).DeadlockTimeout = 990000

Idąc dalej jeżeli maszyna wirtualna, zwłaszcza przy obciążonym systemie nie startuje I pojawi się błąd:

Cluster resource <Resource> timed out. If the pending timeout is too short for this resource, consider increasing the pending timeout value.

Wówczas warto zwiększyć czas potrzebny na uruchomienie się, zwłaszcza dużej maszyny:

(Get-ClusterResourceType “Virtual Machine”).PendingTimeout=800000
(Get-ClusterResourceType “Virtual Machine Configuration”).PendingTimeout=800000

W celu zwiększenia wydajność podsystemu dyskowego CSV warto włączyć Cache wykonując z PowerShell’a:

(Get-Cluster).BlockCacheSize=1024 #Zwiększenie cache do 1 GB – zalecam zwiększenie do 2GB

Jako, że jedna lub niedoborze, kilka maszyn wirtualnych mogą wysycić nam sieć i związaną z kartą sieciową procesor oraz tym bardziej dysk dlatego sugeruje wprowadzenie ograniczeń, i ograniczyć dla dysku maksymalnie 10000 IOPS:

get-vm|Get-VMHardDiskDrive|Set-VMHardDiskDrive -MaximumIOPS 10000 -MinimumIOPS 8000

Informacja dotycząca minimalnej liczby IOPS – w przypadku osiągniecia tejże wartości odpowiedni wpis zostanie zapisany i będzie można go podejrzeć za pomocą Event Viewer’a.

Ograniczenia dla karty sieciowej maszyny wirtualnej:

Get-VMNetworkAdapter -All|Set-VMNetworkAdapter -MaximumBandwidth 300Mb

Powyższe polecenie skonfiguruje również partycje 0, czyli system operacyjny Hyper Visor’a również będzie podlegał ograniczeniom, co nie jest zalecane – dlatego, proponuje wykonać:

Get-VMNetworkAdapter -ManagementOS |Set-VMNetworkAdapter -MaximumBandwidth 50000Mb

A wszystko w celu, aby maszyny wirtualne nie wysyciły sieci i procesora, bo sieć w rozwiązaniach typu Cluster jest bardzo ważna. To przez nią odbywa się ruch HeartBeat, który jest bardzo ważny i powinien być traktowany priorytetowo. Jeżeli poszczególne nody Clustra stracą kontakt na ponad 20 sekund ze sobą po wszystkich sieciach, dla których zdefiniowany jest HeartBeat wówczas taki nod wypadnie z Clustra i wszystkie zasoby z niego zostaną przeniesione na innego noda. Możemy to stwierdzać analizując log Clastrowy, który możemy pobrać komendą:

Get-ClusterLog -Destination C:\AnalizaLogow -UseLocalTime

A w nim zobaczymy takie wpisy:

Line 13821: 00001cd4.000145bc::2018/06/11-10:40:54.588 INFO [IM] Marking Route from 10.11.105.12:~3343~ to 10.11.105.11:~3343~ as down
Line 13960: 00001cd4.000145bc::2018/06/11-10:40:54.591 INFO [IM] Marking Route from 192.168.11.8:~3343~ to 192.168.11.3:~3343~ as down

W Event Viewerze bądą to wpisy:

Cluster network interface node1 – Heartbeat’ for cluster node node1 on network ‘heartbeat’ failed.
Cluster Shared Volume Volume has entered a paused state because of ‘(c0000203)’. All I/O will temporarily be queued until a path to the volume is reestablished.
Cluster node ‘waw01-hpv36’ was removed from the active failover cluster membership. The Cluster service on this node may have stopped. This could also be due to the node having lost communication with other active nodes in the failover cluster.

Warto wspomnieć, że komunikacja HeartBeat odbywa się z wykorzystaniem protokołu UDP i dlatego warto zwiększyć owy czas, że nod clustra nie widzi innych nodów, np. ze względu na jego przeciążenie. Maksymalnie możemy zwiększyć czas do 120 sekund.

(Get-Cluster).sameSubnetThreshold=120
(Get-Cluster).crossSubnetThreshold=120

Dochodzimy do setna, jak już wspomniałem sieć jest bardzo ważna w komunikacji i wykorzystywana jest przynajmniej w 4 wartstwach (W przypadku wirtualizacji):

  • LiveMigration;
  • Ruch CSV;
  • HeartBeat;
  • Komunikacja maszyn wirtualnych;
  • Komunikacja administracyjna np. Przegrywanie plików, backupów.

Powyższe opisywałem w poprzednim artykule, a teraz zajmiemy się obciążeniem procesor versus Karta Sieciowa i maszyna wirtualna. Aby ruch sieciowy wygenerowany przez maszynę wirtualną rozkładał się na poszczególne procesory – i to nie na procesor “0”, który i tak ” ma co robić” powinniśmy włączyć i skonfigurować VMQ.

Get-NetAdaptervmq # Wyświetlenie informacji

To do czego powinniśmy doprowadzić, to aby każda karta była przypisana do innego procesora (core) i robimy to za pomocą polecenia:

Set-NetAdapterVmq -Name “SLOT 3 Port 2” -BaseProcessorNumber nr_procesora

Jeżeli karty pracują w Team (co jest zalecane) wówczas każda z kart powinna wykorzystać maksymalnie połowe procesorów (przy założeniu, że w teamie są 2 karty sieciowe), w przypadku trzech kart sieciowych wartość 1/3 itd.

-MaxProcessors ilość_procesorów

Powyższe ma zastosowanie tylko wtedy, gdy włączmy VMQ, co jest zalecane dla kart o szybkości powyżej 1GB. Dla kart 1 GB i Broadcom nie jest to zalecane, a bynajmniej należy się upewnić, iż mamy aktualny sterownik. Oczywiście w założeniu mam, że dana karta sieciowa wykorzystywana jest przez maszyny wirtualne.

Robimy to dodając parametr.

-Enabled $True

Przykład komendy:

Set-NetAdapterVmq -Name “SLOT 3 Port 2” -BaseProcessorNumber 3 -MaxProcessors 16 -Enabled $True

W przypadku kiedy mamy używane HT w procesorach BaseVmqProcessor może być tylko parzysty.

Dodatkowo jeżeli w jednym Teamie pracują 2 karty sieciowe Max Processors nie może na siebie nachodzić. Czyli jeżeli pierwsza karta używa procesora 2 i mamy MaxProcessors na 14, wówczas pierwsza karta może używać procesora 2,3,4,5,6,7,8,9,10,12,12,13,14,15. A drugą kartę powinniśmy ustawić, iż używa procesora 16 i max Processors również na 14.

Aby maksymalnie wykorzystać moc karty sieciowej powinniśmy ustawić Receive Buffers na maksymalną wielkość, dla różnych kart będą to wielkości typu 4096, 2048 lub Maximum.

Odczyt aktualnej wielkości:

Get-NetAdapterAdvancedProperty “SLOT 3 Port 2” -DisplayName “Receive Buffers”

Ustawienie:

set-NetAdapterAdvancedProperty “SLOT 3 Port 2” -DisplayName “Receive Buffers” -DisplayValue 4096

lub

set-NetAdapterAdvancedProperty “SLOT 3 Port 2” -DisplayName “Receive Buffers” -DisplayValue “Maximum”

Na zakończenie pamiętajmy, iż we współczesnych systemach domyślnie włączony jest Multichanel dla ruchu SMB, a więc przy kopiowaniu plików użyte zostaną wszystkie kary sieciowe, co z kolei może wysycić ruch na karcie HeartBeat i CSV.

Wyłącznie multichanel:

Set-SMBClientConfiguration –EnableMultichannel $False

Set-SmbServerConfiguration -EnableMultiChannel $false

 

Mariusz Ferdyn

Gdyby były jakieś pytania zapraszam do kontaktu.

PS:

Pomyślcie też czy maszyna wirtualna musi przenosić się na inny nod clustra w przypadku braku sieci:

get-vm|Set-VMNetworkAdapter -NotMonitoredInCluster $True

Sprawdzenie poprawności działania komunikacji CSV dla Microsoft Failover Cluster dla Hyper-V

Rozwiązania wysokiej dostępności z wykorzystaniem technologii Microsoft Failover Cluster dla Hyper-V wraz z Clustered Shared Volume konfiguruje się dosyć prosto i można powiedzieć, że rozwiązanie działa out of the box.

Problemy mogą zacząć się, gdy środowisko się rozrasta i/lub zaczyna być poważnie obciążone np. Podczas backupu Clustered Shared Volumes.

W przypadku Clustered Shared Volumes odczyt i zapis danych odbywa się z wykorzystaniem bezpośredniego połączenia każdego węzła z zasobem dyskowym, czy też po iSCSII lub Fibre Chanell. Wyjątek tutaj stanowi zapisywanie metadanych – czyli np. powiększanie pliku, zmiana uprawnień – wówczas wykorzystywany jest ruch CSV po sieci Ethernet do węzła, który jest właścicielem danego dysku.

W przypadku jakichkolwiek problemów z komunikacją możemy ujrzeć następujące błędy, w końcowym stadium powodujące wyłączenie jednego z węzłów.

Source EventID Details
FailoverClustering

1126

Cluster network interface ‘Heartbeat (NIC1) (1)’ for cluster node on network ‘Heartbeat’ is unreachable by at least one other cluster node attached to the network. The failover cluster was not able to determine the location of the failure. Run the Validate a Configuration wizard to check your network configuration. If the condition persists, check for hardware or software errors related to the network adapter. Also check for failures in any other network components to which the node is connected such as hubs, switches, or bridges.
i40ea

27

Intel(R) Ethernet Converged Network Adapter X710 #2 Network link is disconnected.
Hyper-V-VmSwitch

22

Media disconnected on NIC /DEVICE/ (Friendly Name: Microsoft Network Adapter Multiplexor Driver).
MsLbfoSysEvtProvider

16949

Member Nic Disconnected.
i40ea

27

Intel(R) Ethernet Converged Network Adapter X710 Network link is disconnected.
MsLbfoSysEvtProvider

16949

Member Nic Disconnected.
MsLbfoSysEvtProvider

16945

Member Nic Disconnected.
sdddsm

24

MPDISK reservation preempted.
FailoverClustering

1135

Cluster node was removed from the active failover cluster membership. The Cluster service on this node may have stopped. This could also be due to the node having lost communication with other active nodes in the failover cluster. Run the Validate a Configuration wizard to check your network configuration. If the condition persists, check for hardware or software errors related to the network adapters on this node. Also check for failures in any other network components to which the node is connected such as hubs, switches, or bridges.
FailoverClustering

5120

Cluster Shared Volume ‘Volume3’ has entered a paused state because of ‘(c000020c)’. All I/O will temporarily be queued until a path to the volume is reestablished.
FailoverClustering

5120

Cluster Shared Volume ‘Volume4’ has entered a paused state because of ‘(c000020c)’. All I/O will temporarily be queued until a path to the volume is reestablished.
i40ea

27

Intel(R) Ethernet Converged Network Adapter X710 Network link is disconnected.
Hyper-V-VmSwitch

22

Media disconnected on NIC /DEVICE/ (Friendly Name: Microsoft Network Adapter Multiplexor Driver).
MsLbfoSysEvtProvider

16949

Member Nic Disconnected.
i40ea

27

Intel(R) Ethernet Converged Network Adapter X710 #2 Network link is disconnected.

Najważniejsze to rozdzielenie ruchu sieciowego na różne karty sieciowe dla:

  • Maszyn Wirtualnych
  • Live Migration
  • HeartBeat
  • Ruchu CSV
  • Backupu (o ile wykonywany jest po sieci)

Nawet jeżeli nie mamy tyle fizycznych kart sieciowych do rozdzielenia ruchu zastosujmy wirtualne karty sieciowe (Add-VMNetworkAdapter), dodatkowo rozważmy zastosowanie Teamingu kart sieciowych. Poprawny opis konfiguracji sieci w Microsoft Failover Cluster znajdziemy tutaj: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj735302%28v=ws.11%29.

Po, których kartach sieciowych odbywać się ma ruch Kliencki (Maszyn Wirtualnych), HeartBeat oraz ruch Live Migration ustawiamy w Failover Cluster Manager.

Domyślnie ruch CSV będzie odbywał się po sieci HeartBeat – co zazwyczaj jest dobrym wyborem, chyba, że sieć ta nie jest za szybka. Do kontroli, którą siecią ma odbyć się ruch CSV służą metryki. Aby je wyświetlić używamy komendy:

Get-ClusterNetwork|ft Name,Metric,AutoMetric

Użyta zostaje sieć z najniższą metryką i możemy ją zmodyfikować poniższą komendą, aby wybrać sieć dedykowaną do ruch CSV:

(Get-ClusterNetwork eth0).metric=800

Jeżeli natomiast, z jakiś przyczyn chcemy aby ruch CSV odbywał się po sieci klienckiej powinniśmy wykonać (zazwyczaj nie jest to zalecane):

(get-cluster).UseClientAccessNetworksForSharedVolumes=$true

Dodatkowo aby zoptymalizować ruch między węzłami Clustra warto zaznaczyć opcje Microsoft Failover Cluster Virtual Adapter Performance Filer dla kart sieciowych .

Sieć dotyczącą backupu trzeba skonfigurować w programie do owego backupu i w przypadku Veeam robimy to jak poniżej:

Jeszcze raz chciałbym uczulić na odseparowanie ruchu dla CSV i HeartBeat od innego ruchu, gdyż wysycenie łącza dla CSV i Heartbeat może doprowadzić do awarii Clustra.

Na zakończenie warto też zaimplementować reguły QoS dla Clustra, jak poniżej:

# Live Migration
New-NetQosPolicy “Live Migration” –LiveMigration –Priority 4
# CSV
New-NetQosPolicy “SMB” –SMB –Priority 5
# HeartBeat
New-NetQosPolicy “HeartBeat” -IPDstPort 3343 –Priority 6
# Wlaczenie na wszystkich interface QoS
get-VMNetworkAdapter -ManagementOS|Set-VMNetworkAdapter -IeeePriorityTag On

Aby sprawdzić, czy nie następuje wysycenie łącza oraz komponentów systemu odpowiedzialnych za komunikacje miedzy-nodową oraz docelowo wyrzucenie jakiegoś węzła z Clustra proponuje użyć oprogramowania iperf i wygenerować ruch multicast. Proszę używać programu iperf skompilowanego natywnie dla windows w wersji 2, gdyż tylko on prawidłowo obsługuje muliticast. iperf-2.0.4-win32.

Na jednym Nodzie proponuje uruchomić komendę:

iperf.exe   -c 224.0.166.111 -u -T 100 -i 1 -b 9000000000 -t 3600

na drugim Nodzie natomiast:

iperf -s -u -B 224.0.166.111 -i 1

Z założenia ruch ten nie powinien odbywać się poprzez sieć dla CSV oraz Heartbeat. Testy możemy powtórzyć z maszyn wirtualnych. Proszę zauważyć, iż w powyższym teście, również obciążamy wirtualnego switcha (o ile dojdzie do niego ruch), gdyż to on musi zmultiplikować ruch multicast do każdej maszyny wirtualnej.

Możemy zintensyfikować testy uruchamiając kolejne instancje oprogramowania iperf dla kolejnych adresów multicast np. 224.0.166.112, 224.0.166.113, 224.0.166.114.

Przy okazji wspomnę, iż powyższy test pomaga zlokalizować bug w kartach sieciowych Intel(R) Ethernet Converged Network Adapter X710 (Driver Version 1.8.94.0, Firmware: Version: 18.5.17), które w przypadku zainstalowania roli Hyper-V, oraz uruchomienia VMQ rozłączają się, co automatycznie powoduje awarie rozwiązania wysokiej dostępności.

Azure Stack – Web + Mobile, Web App – Oops! – Could not create Web App

Zaraz po zainstalowaniu App Service, mimo to iż widzimy w panelu zarządzającym, iż All Roles Ready, jak tutaj:

Powinniśmy do Planów dodać Serwis Microsoft.Web App:

Zaraz potem jeżeli będziemy chcieli wdrożyć Web App to ujrzymy:

Co robić – zalogujmy się za pomocą RDP do cn0-vm, być może trzeba będzie prze edytować Network Security Group i uruchommy Web Cloud Management Console – sprawdźmy, czy wszystkie serwery działają prawidłowo – a ich uruchomienie może zająć chwilkę:

Wróćmy do statuu App Service i tym razem ujrzymy, że nie wszystkie role są uruchomione. W zależności od szybkości naszego sprzętu może to trochę potrwać (w moim około 2 godzin a hosta miałem dość silnego).

Na zakończenie zobaczymy jednak sukces:

A swoją drogą Web Cloud Management Console to dość fajne narzędzie za pomocą, którego mamy kontrolę nad infrastrukturą App Service i chociażby za pomocą jednego kliknięcia możemy połączyć się za pomocą RDP do Publishera:

 

I pamiętajmy, iż nie możemy kreować Web Aplikacji z adminportal, a tylko z poziomu Subskrybcji (np: https://portal.local.azurestack.external/).


Right after installing the App Service, even though we see in the management panel that All Roles Ready, like here:

We should add the Microsoft.Web App to the Plans:

Immediately afterwards, if we want to implement the Web App, we will see it:

What to do?- Just using RDP go to cn0-vm, you may have to edit the Network Security Group and run the Web Cloud Management Console – let’s check that all servers are working properly – and that they may take a while to start:

Let’s go back to the App Service and this time we will see that not all roles are running. Depending on the speed of our equipment, this may take some time (I have to wait about 2 hours):

However, at the end – we will see success:

By the way, Web Cloud Management Console is quite a nice tool that we have control over the App Service infrastructure and even with just one click we can connect via RDP to Publisher:

 

To create web, API, and Azure Functions apps, you must use the tenant portal (eg. https://portal.local.azurestack.external/) not adminportal.

Azure Stack – App Service install problems

Jeżeli podczas instalacji App Service w Azure Stack napotkamy na problemy w szczególności w fazie Deploy App Service, jak poniżej:

Proponuje:

  1. Przejść do Resource Grupy zawierającej App Service w ASDK będzie to AppService.local i w Activity Log sprawdzić, jaki mieliśmy problem.

  2. Zazwyczaj będzie to problem z maszynami wirtualnymi CN0-VM lub CN1-VM, przechodzimy do nich, i w Activity Log sprawdzamy błędy:

  3. Bardziej znaczące logi można uzyskać logując się do tej maszyny za pomocą RDP – wcześniej odpowiednio konfigurując Network Security Group, tak aby przepuścić połączenia RDP i znajdują się one w:

    C:\Packages\Plugins\Microsoft.Compute.CustomScriptExtension\1.9.1\Status\0.status

  4. Proponuje sprawdzić z tej maszyny czy działa połączenie do bazy danych, która dedykowaliśmy dla App Service za pomocą (oczywiście adres bazy i port podaje jaki przykład):

    Test-NetConnection -ComputerName appservicesql.local.cloudapp.azurestack.external -port 1433

  5. Uruchamiamy Web Cloud Management Console (jest na pulpicie odpowiedni skrót) i potwierdzamy , iż Controller i Management działa prawidłowo:
  6. Otwieramy plik 0.status do edycji i podmieniamy jego zawartość na sukces (w przypadku, kiedy były to błędy typu time-out):[{“status”:{“code”:0,”formattedMessage”:{“lang”:”en-US”,”message”:”Finished executing command”},”name”:”powershell.exe -ExecutionPolicy Unrestricted -Command .\\OnStartAzureVirtualMachineController.ps1″,”operation”:”Command Execution Finished”,”status”:”success”,”substatus”:[{“code”:0,”formattedMessage”:{“lang”:”en-US”,”message”:”Waiting for servers to be ready…\\n2017.05.26 04:59:26 —- Servers are ready!\\n2017.05.26 04:59:27 —- All servers are ready!\\n2017.05.26 04:59:27 —- App Service controller installation and configuration has completed successfully.”},”name”:”StdOut”,”status”:”success”},{“code”:0,”formattedMessage”:{“lang”:”en-US”,”message”:””},”name”:”StdErr”,”status”:”success”}]},”timestampUTC”:”\/Date(1495774767271)\/”,”version”:”1″}]
  7. Wciskamy Retry przy Deploy App Service.

If during the installation of the App Service in Azure Stack we encounter problems in the Deploy App Service phase, as below:

My suggestion is:

  1. Go to the Resource Group containing the App Service (ASDK: AppService.local) and in Activity Log check what problem we had.

  2. Usually this will be a problem with CN0-VM or CN1-VM virtual machines, go to them, and we check errors in Activity Log:

  3. More significant logs can be obtained by logging in to this machine using RDP – previously configuring the Network Security Group to pass the RDP connections. Logs are in:

    C:\Packages\Plugins\Microsoft.Compute.CustomScriptExtension\1.9.1\Status\0.status

  4. I suggest to the connection to the database – example:
    Test-NetConnection -ComputerName appservicesql.local.cloudapp.azurestack.external -port 1433
  5. We can start the Web Cloud Management Console (there is a shortcut on the desktop) and confirm that the Controller and Management are working properly:
  6. Open 0.status and edit the content to success one (if there was time-out error):[{“status”:{“code”:0,”formattedMessage”:{“lang”:”en-US”,”message”:”Finished executing command”},”name”:”powershell.exe -ExecutionPolicy Unrestricted -Command .\\OnStartAzureVirtualMachineController.ps1″,”operation”:”Command Execution Finished”,”status”:”success”,”substatus”:[{“code”:0,”formattedMessage”:{“lang”:”en-US”,”message”:”Waiting for servers to be ready…\\n2017.05.26 04:59:26 —- Servers are ready!\\n2017.05.26 04:59:27 —- All servers are ready!\\n2017.05.26 04:59:27 —- App Service controller installation and configuration has completed successfully.”},”name”:”StdOut”,”status”:”success”},{“code”:0,”formattedMessage”:{“lang”:”en-US”,”message”:””},”name”:”StdErr”,”status”:”success”}]},”timestampUTC”:”\/Date(1495774767271)\/”,”version”:”1″}]
  7. Press Retry in Deploy App Service.

Identyfikacja błędów w logu instalacyjnym appservice_* / Errors Identyfication in appservice_*:

“code”: “ComponentStatus/StdErr/Succeeded”,

“level”: “Info”,

“displayStatus”: “Provisioning Succeeded”,

“message”: “Wait for servers has timed out\\nAt C:\\Packages\\Plugins\\Microsoft.Compute.CustomScriptExtension\\1.9.1\\Downloads\\\\n0\\Common\\common.ps1:457 char:13\\n+ throw New-Object System.TimeoutException \”Wait for server …\\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n + CategoryInfo : OperationStopped: (:) [], TimeoutException\\n + FullyQualifiedErrorId : Wait for servers has timed out\\n \\nC:\\Packages\\Plugins\\Microsoft.Compute.CustomScriptExtension\\1.9.1\\Downloads\\0\\O\\nnStartAzureVirtualMachineController.ps1 : Error while waiting for server to \\nbecome ready. Exit code: 1.\\nAt line:1 char:1\\n+ .\\OnStartAzureVirtualMachineController.ps1 -controllerIndex 0 -feed h …\\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep \\n tion\\n + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio \\n n,OnStartAzureVirtualMachineController.ps1\\n ”

}

],

“statuses”: [

{

“code”: “ProvisioningState/failed/1”,

“level”: “Error”,

“displayStatus”: “Provisioning failed”,

“message”: “Finished executing command”

}

]

}

],

“value”: [

{

“id”: “/subscriptions/ff03660a-cdb3-4a7d-aac9-d119df98aebe/resourceGroups/AppService.local/providers/Microsoft.Resources/deployments/AppService.DeployCloud/operations/D8BBEDE893A93B51”,

“operationId”: “D8BBEDE893A93B51”,

“properties”: {

“provisioningOperation”: “Create”,

“provisioningState”: “Failed”,

“timestamp”: “2018-12-29T13:05:33.2421039Z”,

“duration”: “PT1M23.5284416S”,

“trackingId”: “e3607fe5-a29d-474a-a1c0-91c02719ee72”,

“serviceRequestId”: “3b1547a6-4eba-4ab5-8202-670f250698ab”,

“statusCode”: “Conflict”,

“statusMessage”: {

“status”: “Failed”,

“error”: {

“code”: “ResourceDeploymentFailure”,

“message”: “The resource operation completed with terminal provisioning state ‘Failed’.”,

“details”: [

{

“code”: “VMExtensionProvisioningError”,

“message”: “VM has reported a failure when processing extension ‘OnStart’. Error message: Finished executing command”

}

]

}

},

“targetResource”: {

“id”: “/subscriptions/ff03660a-cdb3-4a7d-aac9-d119df98aebe/resourceGroups/AppService.local/providers/Microsoft.Compute/virtualMachines/CN0-VM/extensions/OnStart”,

“resourceType”: “Microsoft.Compute/virtualMachines/extensions”,

“resourceName”: “CN0-VM/OnStart”

}

}

},

{

“id”: “/subscriptions/ff03660a-cdb3-4a7d-aac9-d119df98aebe/resourceGroups/AppService.local/providers/Microsoft.Resources/deployments/AppService.DeployCloud/operations/6A1B090ABDF12ECD”,

“operationId”: “6A1B090ABDF12ECD”,

“properties”: {

“provisioningOperation”: “Create”,

“provisioningState”: “Succeeded”,

“timestamp”: “2018-12-29T11:40:15.9086899Z”,

“duration”: “PT1M3.229514S”,

“trackingId”: “d094b163-33bf-45d6-99a9-5bc4e3d3889a”,

“serviceRequestId”: “f3b8fecc-740c-4224-9615-36d8036af988”,

“statusCode”: “OK”,

“targetResource”: {

“id”: “/subscriptions/ff03660a-cdb3-4a7d-aac9-d119df98aebe/resourceGroups/AppService.local/providers/Microsoft.Compute/virtualMachines/CN1-VM/extensions/OnStart”,

“resourceType”: “Microsoft.Compute/virtualMachines/extensions”,

“resourceName”: “CN1-VM/OnStart”

}

}

[{“version”:”1″,”timestampUTC”:”2018-12-29T13:03:34.4429755Z”,”status”:{“name”:”SecureCommand_0″,”operation”:”Command Execution Finished”,”status”:”error”,”code”:1,”formattedMessage”:{“lang”:”en-US”,”message”:”Finished executing command”},”substatus”:[{“name”:”StdOut”,”status”:”success”,”code”:0,”formattedMessage”:{“lang”:”en-US”,”message”:”—- Waiting for servers to be ready…\\n2018.12.29 11:58:31 —- Waiting for servers to be ready…\\n2018.12.29 11:59:31 —- Waiting for servers to be ready…\\n2018.12.29 12:00:31 —- Waiting for servers to be ready…\\n2018.12.29 12:01:31 —- Waiting for servers to be ready…\\n2018.12.29 12:02:31 —- Waiting for servers to be ready…\\n2018.12.29 12:03:31 —- Waiting for servers to be ready…\\n2018.12.29 12:04:31 —- Waiting for servers to be ready…\\n2018.12.29 12:05:31 —- Waiting for servers to be ready…\\n2018.12.29 12:06:31 —- Waiting for servers to be ready…\\n2018.12.29 12:07:31 —- Waiting for servers to be ready…\\n2018.12.29 12:08:31 —- Waiting for servers to be ready…\\n2018.12.29 12:09:31 —- Waiting for servers to be ready…\\n2018.12.29 12:10:31 —- Waiting for servers to be ready…\\n2018.12.29 12:11:31 —- Waiting for servers to be ready…\\n2018.12.29 12:12:31 —- Waiting for servers to be ready…\\n2018.12.29 12:13:31 —- Waiting for servers to be ready…\\n2018.12.29 12:14:31 —- Waiting for servers to be ready…\\n2018.12.29 12:15:31 —- Waiting for servers to be ready…\\n2018.12.29 12:16:31 —- Waiting for servers to be ready…\\n2018.12.29 12:17:31 —- Waiting for servers to be ready…\\n2018.12.29 12:18:31 —- Waiting for servers to be ready…\\n2018.12.29 12:19:31 —- Waiting for servers to be ready…\\n2018.12.29 12:20:31 —- Waiting for servers to be ready…\\n2018.12.29 12:21:31 —- Waiting for servers to be ready…\\n2018.12.29 12:22:31 —- Waiting for servers to be ready…\\n2018.12.29 12:23:31 —- Waiting for servers to be ready…\\n2018.12.29 12:24:31 —- Waiting for servers to be ready…\\n2018.12.29 12:25:31 —- Waiting for servers to be ready…\\n2018.12.29 12:26:31 —- Waiting for servers to be ready…\\n2018.12.29 12:27:31 —- Waiting for servers to be ready…\\n2018.12.29 12:28:31 —- Waiting for servers to be ready…\\n2018.12.29 12:29:31 —- Waiting for servers to be ready…\\n2018.12.29 12:30:31 —- Waiting for servers to be ready…\\n2018.12.29 12:31:31 —- Waiting for servers to be ready…\\n2018.12.29 12:32:31 —- Waiting for servers to be ready…\\n2018.12.29 12:33:31 —- Waiting for servers to be ready…\\n2018.12.29 12:34:31 —- Waiting for servers to be ready…\\n2018.12.29 12:35:31 —- Waiting for servers to be ready…\\n2018.12.29 12:36:31 —- Waiting for servers to be ready…\\n2018.12.29 12:37:32 —- Waiting for servers to be ready…\\n2018.12.29 12:38:32 —- Waiting for servers to be ready…\\n2018.12.29 12:39:32 —- Waiting for servers to be ready…\\n2018.12.29 12:40:32 —- Waiting for servers to be ready…\\n2018.12.29 12:41:32 —- Waiting for servers to be ready…\\n2018.12.29 12:42:32 —- Waiting for servers to be ready…\\n2018.12.29 12:43:32 —- Waiting for servers to be ready…\\n2018.12.29 12:44:32 —- Waiting for servers to be ready…\\n2018.12.29 12:45:32 —- Waiting for servers to be ready…\\n2018.12.29 12:46:32 —- Waiting for servers to be ready…\\n2018.12.29 12:47:32 —- Waiting for servers to be ready…\\n2018.12.29 12:48:32 —- Waiting for servers to be ready…\\n2018.12.29 12:49:32 —- Waiting for servers to be ready…\\n2018.12.29 12:50:32 —- Waiting for servers to be ready…\\n2018.12.29 12:51:32 —- Waiting for servers to be ready…\\n2018.12.29 12:52:32 —- Waiting for servers to be ready…\\n2018.12.29 12:53:32 —- Waiting for servers to be ready…\\n2018.12.29 12:54:32 —- Waiting for servers to be ready…\\n2018.12.29 12:55:32 —- Waiting for servers to be ready…\\n2018.12.29 12:56:32 —- Waiting for servers to be ready…\\n2018.12.29 12:57:32 —- Waiting for servers to be ready…\\n2018.12.29 12:58:32 —- Waiting for servers to be ready…\\n2018.12.29 12:59:32 —- Waiting for servers to be ready…\\n2018.12.29 01:00:32 —- Waiting for servers to be ready…\\n2018.12.29 01:01:32 —- Waiting for servers to be ready…\\n2018.12.29 01:02:32 —- Waiting for servers to be ready…\\n2018.12.29 01:03:33 —- Error while waiting for server to become ready. Exit code: 1.\\n\\n”}},{“name”:”StdErr”,”status”:”success”,”code”:0,”formattedMessage”:{“lang”:”en-US”,”message”:”Wait for servers has timed out\\nAt C:\\Packages\\Plugins\\Microsoft.Compute.CustomScriptExtension\\1.9.1\\Downloads\\\\n0\\Common\\common.ps1:457 char:13\\n+ throw New-Object System.TimeoutException \”Wait for server …\\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n + CategoryInfo : OperationStopped: (:) [], TimeoutException\\n + FullyQualifiedErrorId : Wait for servers has timed out\\n \\nC:\\Packages\\Plugins\\Microsoft.Compute.CustomScriptExtension\\1.9.1\\Downloads\\0\\O\\nnStartAzureVirtualMachineController.ps1 : Error while waiting for server to \\nbecome ready. Exit code: 1.\\nAt line:1 char:1\\n+ .\\OnStartAzureVirtualMachineController.ps1 -controllerIndex 0 -feed h …\\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep \\n tion\\n + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio \\n n,OnStartAzureVirtualMachineController.ps1\\n “}}]}}]

Azure Active Directory – Synchronizacja pojedynczego konta, Sprawdzenie synchronizacji, Synchronization of a single account, Checking the synchronization

Jeżeli chcemy sprawdzić stan synchronizacji lub synchronizować jedno konto z Lokalnego Active Directory z Azure Active Directory, logujemy się na maszynę gdzie mamy zainstalowany Azure Ad Connect i uruchamiamy Synchronization Service (“C:\Program Files\Microsoft Azure AD Sync\UIShell\miisclient.exe”).

Widzimy tutaj wszystkie uruchomienia synchronizacji i ewentualnie możemy wejść w detale, aby poznać co kiedy się synchronizowało wraz z ewentualnymi błędami.

Jeżeli chcemy dokonać synchronizacji tylko jednego obiektu np. w celu sprawdzenia błędów, bądź aktualizacji atrybutów, należy go wyszukać – jak poniżej:

Następnie wybieramy Preview, Generate Preview gdzie możemy zapoznać się z ewentualnymi problemami, błędami i ewentualnie Commit Preview i wówczas następuje synchronizacja obiektu.

Na marginesie wspomnę, iż kilka razy obiekt w wypadku użycia PowerShellowej komendy Start-ADSyncSyncCycle -PolicyType Delta nie synchronizował się – albo był w “dziwnym stanie”, a zastosowanie powyższej procedury rozwiązało problem.


If we want to check the synchronization status or synchronize one account from the Local Active Directory with Azure Active Directory, log on to the machine where we have Azure Ad Connect installed and run the Synchronization Service (“C:\Program Files\Microsoft Azure AD Sync\UIShell\miisclient.exe”).

We can see here all the synchronization events and eventually we can go into details to find out what happened when it synchronized with possible errors.

We can synchronize only one object, for example to check for errors or update attributes, you should search for it – as below:

Then choose Preview, Generate Preview where we can see any problems, errors and finally we can press Commit Preview to synchronize the object.

By the way, I will mention that in this way I synchronize the objects that was in a “strange state”, and Start-ADSyncSyncCycle -PolicyType Delta do not fix them.

Azure Stack – ‘Name’ cannot be found on this object. or The SafeOS must be running Windows Server 2016 or Windows 10

Jeżeli podczas uruchamiania pliku .\asdk-installer.ps1 natrafimy na poniższy błąd:

The property ‘Name’ cannot be found on this object. Verify that the property exists and can be set.
At C:\AzureStack_Installer\asdk-installer.ps1:1755 char:1
+ $Runspace_Jobs_Properties.Name = “Jobs”
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException

Oznacza to iż, nie mamy zainstalowanego Windows Management Framework 5.1 – wystarczy go zainstalować i uruchomić instalacje raz jeszcze.

W przypadku błędu:

F_Initialize : The SafeOS must be running Windows Server 2016 or Windows 10 to use the ASDK Installer. Consider upgrading
the SafeOS or use PowerShell to install the ASDK
https://docs.microsoft.com/en-us/azure/azure-stack/asdk/asdk-deploy-powershell
At C:\AzureStack_Installer\asdk-installer.ps1:2802 char:1
+ F_Initialize

Komentujemy linię 1853 i wówczas Azure Stack możemy zainstalować nawet z Windows 8.1 lub Windows 2012 R2.


During running .\asdk-installer.ps1 in case of error:

The property ‘Name’ cannot be found on this object. Verify that the property exists and can be set.
At C:\AzureStack_Installer\asdk-installer.ps1:1755 char:1
+ $Runspace_Jobs_Properties.Name = “Jobs”
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException

It means that we have not installed Windows Management Framework 5.1 – so please install it.

In case of error:

F_Initialize : The SafeOS must be running Windows Server 2016 or Windows 10 to use the ASDK Installer. Consider upgrading
the SafeOS or use PowerShell to install the ASDK
https://docs.microsoft.com/en-us/azure/azure-stack/asdk/asdk-deploy-powershell
At C:\AzureStack_Installer\asdk-installer.ps1:2802 char:1
+ F_Initialize

Please comment line 1853 then we can install Azure Stack from Windows 8.1 or Windows 2012 R2.

Uzyskanie praw Global Administratora / How to get Global Administrator rights

Ze względu na specyfikę działania serwisów chmurowych Microsoft oraz samego działania Azure Active Directory może się zdarzyć, iż będziemy mieli dostęp do usługi katalogowej w Azure, w której nie mamy praw Global Admina. O ile w pierwszym momencie korzystania zwłaszcza z obcych usług, może nam to nie przeszkadzać, ale jeżeli będziemy adoptować nowe usługi chmurowe Microsoft okaże się to uciążliwe, a może i niezbędne – np. przy zarządzaniu kontem partnerskim Microsoft. Przy okazji warto zapoznać się z tym wpisem opisującym doświadczalnie zachowanie się Azure Active Directory.

Jak więc uzyskać uprawnienia Global Administratora:

  1. Logujemy się do portal.azure.com i przechodzimy do Azure Acctive Directory i All users. Jak widzimy nie mamy żadnego użytkownika z uprawnieniami Global Administratora.
  2. Zalogujemy się do strony https://powerbi.com/ i wybierzmy START FREE i TRY FREE
  3. Tutaj przy logowaniu prawdopodobnie wyświetli się opcja, iż mamy już konto w Azure Active Directory dlatego zalogujmy się do tego konta, ale już poprzez witrynę office.com
  4. Po wciśnięciu Admin powinniśmy otrzymać screen jak poniżej:
  5. Tutaj już sprawa prosta wciskamy opcje chcę być administratorem i dalej prawdopodobnie będziemy musieli weryfikować fakt bycia administratorem domeny internetowej, a więc będziemy musieli do rekordów domeny dodać rekord TXT. Gdy tylko to zrobimy staniemy się Administratorem Globalnym, wystarczy wylogować się i zalogować ponownie.


    Due to the specifics of the operation of Microsoft cloud services and the Azure Active Directory itself, it may happen that we will have access to theAzure Active Directory, in which we do not have Global Admin rights. While in the first moment of using especially foreign services, it may not disturb us, but if we adopt new Microsoft cloud services, it will be cumbersome, and sometime it is necessary to have Global Administrator Rights – for an example when managing a Microsoft partner account. By the way, please also read this article.

    So how do you get the Global Administrator privileges:

    1. Log to the portal.azure.com  and go to Azure Acctive Directory and All users. As we see we do not have Global Administrator Rights..
    2. Log to https://powerbi.com/ and choose START FREE and TRY FREE
    3. Here you will probably see the message that you already have an account in Azure Active Directory, so log in to this account, but now via office.com
    4. After pressing Admin, we should get a screen like this (Would you like to become administrator):
    5. We are almost at home just presy Yes and you will probably have to verify the internet domain by adding TXT record to the domain records. As soon as you do, you will become a Global Administrator, simply log out and log in again.

Powyższa procedura przydatna podczas napotkania komunikatów/ The above procedure is useful when encountering messages:

We have moved MPN membership management from Partner Membership Center (PMC) to the Partner Center—the single destination to manage your business relationship with Microsoft. After you move, you’ll maintain existing benefits and have access to additional tools such as customer referrals and go-to-market services​

To continue using your membership benefits, you need to move your account now.

Welcome to Partner Center!
To make it easier for you to manage and grow your business, we’re consolidating features and functions that are currently spread across separate sites onto one platform, the Microsoft Partner Center portal.
To successfully move your data from Partner Membership Center and create an account for Partner Center, you’ll need to have on hand the following information. You may want to take a few minutes to gather these items before you get started:
Global administrator credentials for your work account
You’ll need to provide the user name and password you use to sign into Office 365, Microsoft Azure, or Microsoft Dynamics CRM. If you don’t have a work account, you can create one during the enrollment process.
Your organization’s legal business name, address, primary contact, and support details
We need this information to confirm that your organization has an established profile with Microsoft and that you are authorized to act on its behalf.
Authority to sign the agreement
Ensure that you are authorized to sign legal agreements on your organization’s behalf as you’ll be asked to do so during the enrollment process.
We’ll verify the information you provided.

Azure Stack – step 60.120 failed, name could not be resolved login.microsoftonline.com, problemy z siecią/network problems

W czasie wdrażania Azure Stack możemy spotkać błąd typu:

Invoke-EceAction : Action: Invocation of step 60.120 failed. Stopping invocation of action plan.

Pierwszym krokiem będzie ponowne uruchomienie instalatora:

cd C:\CloudDeployment\Setup
PS C:\CloudDeployment\Setup> .\InstallAzureStackPOC.ps1 -rerun

Po-czym zapewne zobaczymy:

Invoke-EceAction : Action: Invocation of step 60 failed. Stopping invocation of action plan.
At C:\CloudDeployment\Setup\DeploySingleNode.ps1:809 char:5
+ Invoke-EceAction -RolePath $masterRole -ActionType $actionPlan @d …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-EceAction], ActionExecutionException
+ FullyQualifiedErrorId : Unspecified error,CloudEngine.Cmdlets.InvokeCmdlet

Bardzo często świadczy, to o problemach sieciowych – zwłaszcza, że instalator w tym zakresie nie jest precyzyjny, a my nie-czytając dokumentacji podajemy błędne parametry sieci dla BGPNAT.

Jeżeli przejdziemy troszkę do góry w logu zobaczymy prawdopodobnie problem z rozwiązywaniem nazwy login.microsoftonline.com

 

Możemy jeszcze zweryfikować i sprawdzić wydając polecenie:

PS C:\CloudDeployment\Setup> ping login.microsoftonline.com
Ping request could not find host login.microsoftonline.com. Please check the name and try again.

 

Jak rozwiązać tego typu problem.

Sprawdzić czy prawidłowo ustawiony jest forwarder w DNS na maszynie AzS-DC01 (Uruchamiamy Hyper-V managera i możemy się do niej zalogować używając loginu azurestack\AzureStackAdmin). Niestety jest to maszyna Windows Server Core więc działamy z PowerShella.
Jeżeli tego nie lubimy na naszej głównej maszynie (tej uruchomionej z CloudBuilder.vhdx) uruchamiamy mmc i dodajemy przystawkę DNS i łączymy się z AzS-DC01.azurestack.local i sprawdzamy ustawienia DNS.

Jak widać ustawione mamy, aby w przypadku braku połączenia do Forwardera używał RootHintsów, więc raczej to nie jest to, chyba, że mamy zablokowane odpytywanie zewnętrznych DNSów (UDP/TCP port 53).

Bardziej prawdopodobne, że mamy źle skonfigurowanego NATa na maszynie AzS-BGPNAT01 – w moim przypadku po wydaniu ipconfig oczom ujrzał mi się wpis:

No właśnie – mamy dla interface zewnętrznego przyporządkowany adres 172.25.229.0 !!! Założeniem było, że nasza sieć będzie miała adres 172.25.229.0/24, a pierwszy host to 172.25.229.1. Tak więc musimy zmienić nie tylko adres IP karty Ethernet, ale także reguły NATowania – jak to robimy:

get-netnat #wyświetlamy NATa
Get-NetNat|Remove-NetNat #musimy skasować NATa, bo nie możemy rekonfigurować adresu zewnętrznego
Netsh interface ipv4 set address “ethernet” static 172.25.229.1 255.255.255.0 172.25.229.254 #Ustawiamy nowy adres ip, pamiętajmy, aby to robić po skasowaniu NATa – w przyciwnym wypadku nam się nie uda skasować NATa.
New-NetNat -Name “BGPNAT” -ExternalIPInterfaceAddressPrefix 172.16.229.0/24 #Robimy nowego NATa
Add-NetNatExternalAddress -NatName “BGPNAT” -IPaddress 172.25.229.1 -PortStart 5000 -PortEnd 49151

I od tego momentu powinniśmy móc wykonać ping na 8.8.8.8, a z innych hostów powinićmy móc wykonać ping dns.pl

Powyższej procedury można używać też do zmieniania zewnętrznego adresu ip – aczkolwiek nie jest to cała procedura.


During the implementation of Azure Stack, we can encounter an error of the type:

Invoke-EceAction : Action: Invocation of step 60.120 failed. Stopping invocation of action plan.

The first step will be to restart the installer:

cd C:\CloudDeployment\Setup
PS C:\CloudDeployment\Setup> .\InstallAzureStackPOC.ps1 -rerun

That propably finish with this:

Invoke-EceAction : Action: Invocation of step 60 failed. Stopping invocation of action plan.
At C:\CloudDeployment\Setup\DeploySingleNode.ps1:809 char:5
+ Invoke-EceAction -RolePath $masterRole -ActionType $actionPlan @d …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-EceAction], ActionExecutionException
+ FullyQualifiedErrorId : Unspecified error,CloudEngine.Cmdlets.InvokeCmdlet

It seems to be a network problem – especially with configuration of BGPNAT and we will probaly find in our output something similar to “could not be resolved login.microsoftonline.com”.

 

We can verify network problems with:

PS C:\CloudDeployment\Setup> ping login.microsoftonline.com
Ping request could not find host login.microsoftonline.com. Please check the name and try again.

 

How to resolve this type of problem.

Check if the forwarder is correctly set in DNS on the AzS-DC01 machine (We can run the Hyper-V manager and we can log in to it using the azurestack\AzureStackAdmin login). Unfortunately, this is a Windows Server Core machine, so we have to use PowerShell.
If you do not like it on our main machine (this one launched from CloudBuilder.vhdx), run mmc and add the DNS snap-in and connect to AzS-DC01.azurestack.local and check the DNS settings.

 

As you can see, we use RootHints in the absence of connection to the Forwarder, so this is probably not the case, unless we have blocked external DNS polling (UDP / TCP port 53).

More likely, we have a wrongly configured NAT on the AzS-BGPNAT01 machine – in my case, after the release of ipconfig, I saw an entry:

 

We have an address for the external interface 172.25.229.0 !!! The assumption was that our network should have the address 172.25.229.0/24, and the first host is 172.25.229.1. So we have to change not only the IP address of the Ethernet card, but also the NAT rule – how we do it:

get-netnat #display NAT
Get-NetNat|Remove-NetNat #we need to delete NAT – we can not reconfigure external address
Netsh interface ipv4 set address “ethernet” static 172.25.229.1 255.255.255.0 172.25.229.254 #Set a new ip address, in order to delete NAT the adress should match.
New-NetNat -Name “BGPNAT” -ExternalIPInterfaceAddressPrefix 172.16.229.0/24 #create a new NATa
Add-NetNatExternalAddress -NatName “BGPNAT” -IPaddress 172.25.229.1 -PortStart 5000 -PortEnd 49151

 And from that moment we should be able to ping on 8.8.8.8, and from other hosts we should be able to ping dns.pl.

The above procedure can also be used to change the external IP address – although this is not the entire procedure.

 

Konfiguracja uwierzytelnienia z wykorzystaniem Azure Active Directory w Apache / Apache and Azure Active Directory OpenID – Oauth

Ostatnio nadarzyła mi się konieczność skonfigurowania uwierzytelnienia z wykorzystaniem Azure Active Directory w Apache. Na przykładzie CentOs podaje jak to zrobić z wykorzystaniem OpenID / Oauth.

Instalujemy Apche oraz przykładowe komponenty wykorzystywane do testów:

yum -y install httpd
yum -y install mod_ssl
yum -y install php
yum -y install mc

Startujemy Apache wraz z ustawieniem autostartu serwisu:

systemctl enable httpd.service
systemctl start httpd.service

Do /var/www/html/ wrzucami przykładową stronę w php:

<?php
phpinfo();
?>

Proponuje, zainstalować certyfikat SSL testowy z wykorzystaniem narzędzia http://ssl4ip.westeurope.cloudapp.azure.com/ oraz DigiCert Util, aby wyeksportować .pfx do .cer i .key. Wstawiamy certyfikat dla naszej strony, a następnie w tym samym pliku pośrednie centrum certyfikacji i klucz prywatny do odpowiednich plików:

vi /etc/pki/tls/private/localhost.key
vi /etc/pki/tls/certs/localhost.crt
service httpd restart

Na pierwsze testy włączamy uwierzytelnianie Basic:

cd /var/www/html
touch .htpasswd
htpasswd .htpasswd a
I podajemy hasło np. a

Kreujemy plik .htaccess:

vi /var/www/html/.htpasswd

o treści:

AuthType Basic
AuthName “Azure Active Directory”
AuthUserFile /var/www/html/.htpasswd
Require valid-user

Jeszcze musimy prze-konfigurować Apache, aby akceptował nadpisywanie zmian z plików .htaccess:

vi /etc/httpd/conf/httpd.conf

i zmieniamy wszędzie z AllowOverride none na AllowOverride All, a na koniec restartujemy Apache:

service httpd restart

Od tego momentu powinniśmy wejść na stronę np.: https://213-199-133-54.h.com.pl, gdzie 213.199.133.54 to ip naszego serwera z Apache – wykorzystujemy DNS i certyfikat z http://ssl4ip.westeurope.cloudapp.azure.com/.

Po podaniu loginu ja hasła powinniśmy dostać się do strony. To teraz trzeba prze-konfigurować funkcjonalność, tak aby do tego celu wykorzystywać Azure Active Directory.

Instalujemy pakiet mod_auth_openidc:

yum install mod_auth_openidc
repoquery -l mod_auth_openidc

w pliku (vi /etc/httpd/conf.d/auth_openidc.conf) dodajemy:

OIDCProviderMetadataURL https://login.microsoftonline.com/2f5c0b12-3c26-4d04-9c4f-22b2dc35c /v2.0/.well-known/openid-configuration
# OIDCRedirectURI is a vanity URL that must point to a path protected by this module but must NOT point to any content
OIDCRedirectURI https://213-199-133-54.h.com.pl/a
OIDCCryptoPassphrase random1234
OIDCClientID 5ed1690e-b7d1-48b8-9eae-bcad7ddad
OIDCClientSecret WGxILH2Rk2IgTx5YwYHH7Sxpit4yrUDTQ=

Gdzie:

2f5c0b12-3c26-4d04-9c4f-22b2dc35c – Id Tenant’u Azure Active Directory
https://213-199-133-54.h.com.pl/a – przekierowanie po powrocie – katalog, a nie musi istnieć, ale tutaj wrócimy np. z błędem uwierzytelnienia
5ed1690e-b7d1-48b8-9eae-bcad7ddad – Id Aplikacji z Azure Active Directory
WGxILH2Rk2IgTx5YwYHH7Sxpit4yrUDTQ= – secret – dodany w portalu w danej aplikacji.

Na zakończenie zmieniamy /var/www/html/.htaccess na:

AuthType openid-connect
Require valid-user

I wydajemy service httpd restart i uwierzytelnianie z wykorzystaniem Azure Active Directory już działa.

Możemy skonfigurować, że użytkownik musi mieć nadane uprawnienia, aby skorzystać z danej aplikacji.
Być może wkrótce Video Step by Step jak to wszystko zrobić, gdyż jeden obraz mówi więcej niż tysiące słów – a co dopiero Video.


Recently, I have to configure authentication using Azure Active Directory in Apache. How to do it using CentOs 7.5 using OpenID / Oauth.

First step is to install Apache and some other components:

yum -y install httpd
yum -y install mod_ssl
yum -y install php
yum -y install mc

Start Apache and set it to autostart:

systemctl enable httpd.service
systemctl start httpd.service

Put to /var/www/html/ sample webpage:

<?php
phpinfo();
?>

I suggest installing a test SSL certificate using the tool from http://ssl4ip.westeurope.cloudapp.azure.com/ and DigiCert Util to export .pfx to .cer / .key. We insert the certificate for our site and then in the same file the intermediate certificate and the private key to the appropriate files::

vi /etc/pki/tls/private/localhost.key
vi /etc/pki/tls/certs/localhost.crt
service httpd restart

At the beginning lets test with Basic Authentication:

cd /var/www/html
touch .htpasswd
htpasswd .htpasswd a

and provide password.

Please create .htaccess file:

vi /var/www/html/.htpasswd

with:

AuthType Basic
AuthName “Azure Active Directory”
AuthUserFile /var/www/html/.htpasswd
Require valid-user

Please reconfigure Apache:

vi /etc/httpd/conf/httpd.conf

replace everywhere from AllowOverride none to AllowOverride All, and restart Apache:

service httpd restart

From that moment, we should go to the site, for example: https://213-199-133-54.h.com.pl, where 213.199.133.54 is the IP of our server with Apache – we use DNS and the certificate from http: // ssl4ip. westeurope.cloudapp.azure.com/.

After entering the login password, we should get to the site. It is now necessary to reconfigure the functionality so that Azure Active Directory can be used for this purpose.

Please install mod_auth_openidc:

yum install mod_auth_openidc
repoquery -l mod_auth_openidc

Add to /etc/httpd/conf.d/auth_openidc.conf:

OIDCProviderMetadataURL https://login.microsoftonline.com/2f5c0b12-3c26-4d04-9c4f-22b2dc35c /v2.0/.well-known/openid-configuration
# OIDCRedirectURI is a vanity URL that must point to a path protected by this module but must NOT point to any content
OIDCRedirectURI https://213-199-133-54.h.com.pl/a
OIDCCryptoPassphrase random1234
OIDCClientID 5ed1690e-b7d1-48b8-9eae-bcad7ddad
OIDCClientSecret WGxILH2Rk2IgTx5YwYHH7Sxpit4yrUDTQ=

Where:

2f5c0b12-3c26-4d04-9c4f-22b2dc35c – Azure Azctive Directory Tenant ID
https://213-199-133-54.h.com.pl/a – redirection on the return – a directory, does not have to exist, but here we will return, eg with an authentication error
5ed1690e-b7d1-48b8-9eae-bcad7ddad – Application ID from Azure Active Directory
WGxILH2Rk2IgTx5YwYHH7Sxpit4yrUDTQ= – secret – added in the portal in the given application.

Modify /var/www/html/.htaccess to:

AuthType openid-connect
Require valid-user

And we release service httpd restart and authentication using Azure Active Directory is already working.

We can configure that the user must be granted permission to use the application.
Maybe soon I will record Step by Step Video how to do it.


Some screenshot / Kilka obrazków poglądowych:

 

 

 

 

 

 

 

 

 

 

Testowi użytkownicy w nowej domenie Active Directory

Czasami musimy w celach testowych uruchomić Active Directory. Warto by zasilić nowo postawiona instancję kilkoma użytkownikami. W poniższym linku znajduje się skrypt, który bardzo ładnie to robi i zasysa użytkowników z pliku CSV, co może być przydatne również przy wgrywaniu realnych użytkowników do nowo postawionej domeny.


Sometimes we need to run Active Directory for testing purposes. It’s worth to fill the new instance up with several users. The following link contains a script that import users from a CSV file, which can also be useful when uploading real users to a newly created domain.

Script:

https://gallery.technet.microsoft.com/scriptcenter/Create-UsersGroup-for-9ee1de26

Android, iOS, oSX, Windows – Apache Cordova / Azure

Apache Cordova to narzędzie za pomocą, którego możemy za jednym zamachem pisać aplikacje (zazwyczaj biznesową) i kompilować ją dla:

  • android
  • browser
  • ios
  • osx
  • windows ~6.0.0

Mamy też wsparcie dla Azure.

Proces instalacji opisany jest na głównej stronie projektu, a stworzenie nowej aplikacji ogranicza się do wydania komend:

  • npm install -g cordova (instalacja)
  • cordova create MyApp
  • cd MyApp
  • cordova platform list
  • cordova platform add browser
  • cordova platform add android
  • cordova run browser

lub

  • cordova build android

 

Jeżeli naszą platformą wyjściową ma być Android wówczas należy postępować wg: https://cordova.apache.org/docs/en/8.x/guide/platforms/android/index.html

 

Z tego co zauważyłem lepiej radzi sobie wersja pod Linux (ze względu na wykorzystane produktu np. Gradle). Jeżeli nie mamy Linux’a pod ręką polecam zapoznać się z tym artykułem.

Najbardziej uciążliwą rzeczą jest ustawienie odpowiednich ścieżek i zmiennych środowiskowych (Błąd No installed build tools found. Install the Android build tools version 19.1.0 or higher). Poniżej lista dla Linux i Windows przy kompilacjach dla platformy Android i zainstalowaniu Android Studio dla użytkownika mf:

  • PATH=$PATH:/opt/jdk1.8.0_191/bin
  • PATH=$PATH:/opt/android-studio/bin
  • PATH=$PATH:/home/mf/Android/Sdk/platform-tools
  • PATH=$PATH:/home/mf/Android/Sdk/build-tools/28.0.3
  • PATH=$PATH:/home/mf/Android/Sdk/tools
  • PATH=$PATH:/home/mf/Android/Sdk/tools/bin
  • JAVA_HOME=/opt/jdk1.8.0_191/
  • export JAVA_HOME
  • ANDROID_HOME=/home/mf/Android/Sdk/
  • export ANDROID_HOME

 

  • Path=
  • C:\Users\mf\AppData\Local\Android\Sdk\build-tools\28.0.3
  • C:\jdk1.8.0_191\bin;C:\Program Files\nodejs\
  • C:\Program Files\Android\Android Studio\bin
  • C:\Users\mf\AppData\Local\Android\Sdk\tools
  • C:\Users\mf\AppData\Local\Android\Sdk\platform-tools
  • C:\Program Files\Android\Android Studio\bin
  • C:\Users\mf\AppData\Local\Android\Sdk\emulator
  • C:\Users\mf\AppData\Local\Android\Sdk\tools\bin
  • C:\Users\mf\AppData\Local\Android\Sdk\tools\proguard\bin
  • C:\Users\mf\scoop\shims;C:\Users\mf\AppData\Local\Microsoft\WindowsApps
  • C:\Users\mf\AppData\Roaming\npm
  • ANDROID_HOME=C:\Users\mf\AppData\Local\Android\Sdk
  • ANDROID_STUDIO=C:\Program Files\Android\Android Studio
  • APPDATA=C:\Users\mf\AppData\Roaming
  • JAVA_HOME=C:\jdk1.8.0_191

Jeżeli napotkamy na błędy:

Minimum supported Gradle version is 4.4. Current version is 4.1.

polecam skorzystać z wersji dla Linux, lub stosować ten artykuł.


Apache Cordova is a fantastic tool that can compile applications for:

  • android
  • browser
  • ios
  • X-axis
  • windows ~ 6.0.0

We also have Azure support:

The installation process is described on the main project page and the creation of a new application is limited to issuing following commands:

  • npm install -g cordova (instalacja)
  • cordova create MyApp
  • cd MyApp
  • cordova platform list
  • cordova platform add browser
  • cordova platform add android
  • cordova run browser

or

  • cordova build android

 

If our destination platform is Android we should follow: https://cordova.apache.org/docs/en/8.x/guide/platforms/android/index.html

I noticed, that the Linux version works better (due to the product used, eg Gradle). If we do not have Linux at hand, I recommend reading this post.

The most troublesome thing is to set the right environment paths and variables (error: No installed build tools found. Install the Android build tools version 19.1.0 or higher). Below is a list for Linux and Windows on the compilations for the Android platform and the installation of Android Studio for the mf user:

  • PATH=$PATH:/opt/jdk1.8.0_191/bin
  • PATH=$PATH:/opt/android-studio/bin
  • PATH=$PATH:/home/mf/Android/Sdk/platform-tools
  • PATH=$PATH:/home/mf/Android/Sdk/build-tools/28.0.3
  • PATH=$PATH:/home/mf/Android/Sdk/tools
  • PATH=$PATH:/home/mf/Android/Sdk/tools/bin
  • JAVA_HOME=/opt/jdk1.8.0_191/
  • export JAVA_HOME
  • ANDROID_HOME=/home/mf/Android/Sdk/
  • export ANDROID_HOME

 

  • Path=
  • C:\Users\mf\AppData\Local\Android\Sdk\build-tools\28.0.3
  • C:\jdk1.8.0_191\bin;C:\Program Files\nodejs\
  • C:\Program Files\Android\Android Studio\bin
  • C:\Users\mf\AppData\Local\Android\Sdk\tools
  • C:\Users\mf\AppData\Local\Android\Sdk\platform-tools
  • C:\Program Files\Android\Android Studio\bin
  • C:\Users\mf\AppData\Local\Android\Sdk\emulator
  • C:\Users\mf\AppData\Local\Android\Sdk\tools\bin
  • C:\Users\mf\AppData\Local\Android\Sdk\tools\proguard\bin
  • C:\Users\mf\scoop\shims;C:\Users\mf\AppData\Local\Microsoft\WindowsApps
  • C:\Users\mf\AppData\Roaming\npm
  • ANDROID_HOME=C:\Users\mf\AppData\Local\Android\Sdk
  • ANDROID_STUDIO=C:\Program Files\Android\Android Studio
  • APPDATA=C:\Users\mf\AppData\Roaming
  • JAVA_HOME=C:\jdk1.8.0_191

If we found this kind of errors:

Minimum supported Gradle version is 4.4. Current version is 4.1.

I suggest to use Linux version, or read these posts.

Remote Desktop to Linux

Na co dzień, na komputerze desktop pracuje używając systemu Windows – czasami jednak potrzebuje oprogramowanie, które działa (np. bezbłędnie) tylko na linux. O ile oprogramowanie to działa w powłoce (shell), wystarczy dostęp do dowolnego systemu Linux poprzez SSH i uruchomienie oprogramowania. Gorzej, gdy potrzebujemy Graficznego Interface Użytkownika (GUI). I tym razem Azure może przyjść nam z pomocą – wystarczy wdrożyć, np. Ubuntu 18.10 i następnie wydać następujące polecenia:

apt-get -y update
apt-get -y install tasksel
tasksel install ubuntu-desktop
apt-get -y install xrdp
systemctl enable xrdp
service xrdp stop
echo xfce4-session >~/.xsession
service xrdp start
service xrdp status

Od tego momentu możemy z Linux połączyć się graficznie za pomocą oprogramowania Remote Desktop.

Usually I am using Windows based desktop Sometime I need to run software that works (without errors) only on Linux. If the software works in the shell, all you need is access to any Linux system via SSH and run the software. Worse, when we need Graphical User Interface (GUI). Using Azure we can launch for an example, Ubuntu 18.10 and then issue the following commands:

apt-get -y update
apt-get -y install tasksel
tasksel install ubuntu-desktop
apt-get -y install xrdp
systemctl enable xrdp
service xrdp stop
echo xfce4-session> ~ /.xsession
service xrdp start
service xrdp status

From that moment, we can connect graphically with Linux using the Remote Desktop software.

Rozwiązywanie konfliktów synchronizacji AD Connect / Resolving AD Connect synchronization conflicts / ImmutableID

Jeżeli korzystamy z oprogramowania AD Connect do synchronizacji kont lokalnego Active Directory, a wcześniej mieliśmy założone jakiś konta w Azure Active Directory, wówczas wcześniej czy później spotkamy się z konfliktem założenia konta w Azure Active Directory na podstawie konta Active Directory. Zdarzy się to w przypadku, kiedy mamy identyczny UPN w Active Directory i azłożymy konto w Azure Active Directory o takim samym mailu, które będzie miało role Global Administratora. Wówczas AD Connect założy konto w domenie @onmicrosoft.com a do nazwy użytkownika doda kilka cyferek i będziemy mieli konta:

  • mariusz.ferdyn8858@mojadomena.onmicrosoft.com
  • mariusz.ferdyn@mojadomena.pl

Do połączenia (matchowania) kont Azure Active Directory I Active Directory służy atrybut ImmutableID. I mówiąc, krótko musimy ustawić ten atrybut dla już istniejącego konta w Azure Active Directory, poniższą procedurą:

  1. Przenieść użytkwonika w Active Directory do konteneru, który nie jest synchronizwany
  2. Dokonać synchronizacji (Start-ADSyncSyncCycle -PolicyType Delta)
  3. Wyświetlić ImmutableID poleceniem:
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn8858@mojadomena.onmicrosoft.com|fl
  4. Usunąć użytkownika z Azure Active Directory
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn8858@mojadomena.onmicrosoft.com|Remove-MsolUser -RemoveFromRecycleBin
  5. Dokonać synchronizacji (Start-ADSyncSyncCycle -PolicyType Delta)
  6. Wyświetlić parametry istniejącego użytkownika w Azure Active Directory
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn@mojadomena.pl|fl
  7. Ustawić immutableid otzrymane z polecenia 3, poprzez:
    get-MsolUser -UserPrincipalName mariusz.ferdyn@mojadomenapl.pl|Set-MsolUser -ImmutableId “W7gqU22hws4tpsPw==”
  8. Dokonać synchronizacji (Start-ADSyncSyncCycle -PolicyType Delta)

Po powyższym konta powinny być zsynchronizowane prawidłowo, a sama metoda może być stosowana do migracji użytkowników między domenami.


If we use AD Connect software to synchronize Active Directory local accounts, and previously we had some accounts in Azure Active Directory, sooner or later we will meet with the conflict of setting up an account in Azure Active Directory based on the Active Directory account. This will happen if we have the same UPN in Active Directory and set up an account in Azure Active Directory with the same e-mail that have the role of Global Administrator. Then AD Connect will create an account in the @ onmicrosoft.com domain and add a few numbers to the username, so we will have accounts:

  • mariusz.ferdyn8858@mojadomena.onmicrosoft.com
  • mariusz.ferdyn@mojadomena.pl

The ImmutableID attribute is used to connect (match) Azure Active Directory and Active Directory accounts. To merge two accounts, we have to set this attribute for an existing account in Azure Active Directory, with the following procedure:

  1. Move the user in Active Directory to a container that is not synchronizing
  2. Synchronize (Start-ADSyncSyncCycle -PolicyType Delta)
  3. Display ImmutableID with the command:
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn8858@mydomain.onmicrosoft.com|fl
  4. Remove the user from Azure Active Directory
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn8858@mydomain.onmicrosoft.com|Remove-MsolUser -RemoveFromRecycleBin
  5. Synchronize (Start-ADSyncSyncCycle -PolicyType Delta)
  6. View the parameters of an existing user in Azure Active Directory
    get-MsolUser -ReturnDeletedUsers -UserPrincipalName mariusz.ferdyn@mydomain.com|fl
  7. Set the immutableid from the command 3, by:
    get-MsolUser -UserPrincipalName mariusz.ferdyn@mojadomenapl.pl|Set-MsolUser -ImmutableId “W7gqU22hws4tpsPw ==”
  8. Synchronize (Start-ADSyncSyncCycle -PolicyType Delta)

After the above, the accounts should be synchronized correctly, and the method can be used to migrate users between domains.

Install-Module : The term ‘Install-Module’ is not recognized as the name of a cmdlet – AzureRM, MSOnline

Jeżeli chcemy zainstalować moduł PowerShell do zarządzania np. Azure (AzureRM) na Windows 7, Windows 8, Windows 2008 R2, Windows 2012, Windows 2012R2 i w tym celu wydamy komendę:

Install-Module AzureRM

Zobaczymy błąd:

Install-Module : The term ‘Install-Module’ is not recognized as the name of a cmdlet, funce program. Check the spelling of the name, or if a path was included, verify that the path
At line:1 char:1
+ Install-Module AzureRM
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundE + FullyQualifiedErrorId : CommandNotFoundException

 

Aby rozwiązać ten problem do niedawna trzeba było korzystać z Web Platform Installer. Jedną z trochę zapomnianych jest zainstalowanie PackageManagement PowerShell Modules. Po instalacji pakietu mamy dostęp do komendy ‘Install-Module’ i możemy zainstalować nie tylko AzureRM, jak również np. moduł MSOnline:

Install-Module MSOnline

 


 

If you want to install the PowerShell module for managing eg. Azure (AzureRM) on Windows 7, Windows 8, Windows 2008 R2, Windows 2012, Windows 2012R2 and for this purpose we will issue the command:

Install-Module AzureRM

We will see:

Install-Module : The term ‘Install-Module’ is not recognized as the name of a cmdlet, funce program. Check the spelling of the name, or if a path was included, verify that the path
At line:1 char:1
+ Install-Module AzureRM
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundE + FullyQualifiedErrorId : CommandNotFoundException

 

To solve this problem we usually had to use the Web Platform Installer. But there is another option – just install PackageManagement PowerShell Modules. After installing the package we have access to the ‘Install-Module’ command and we can install not only AzureRM, but also for example the MSOnline module:

Install-Module MSOnline

 

Migracja z Modelu Klasycznego do Azure Resource Manager / Migration from the Classic Model to Azure Resource Manager

Mimo, iż Azure Resource Manager ma już ładnych kilka lat – zdarza się, iż zastajemy Subskrybcje, gdzie usługi wdrożone są w modelu Classic.

Poniższe kroki migrują Storage Account z Modelu klasycznego do ARM.

Login-AzureRmAccount

Register-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate

Get-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate #Wait for registered

Add-AzureAccount

Get-AzureSubscription

Select-AzureSubscription -SubscriptionId “subscription id”

Get-AzureStorageAccount

$storageAccountName=”imagesmf”

$validate=Move-AzureStorageAccount -Validate -StorageAccountName $storageAccountName -Verbose

$validate

$validate.ValidationMessages

Move-AzureStorageAccount -Prepare -StorageAccountName $storageAccountName

Move-AzureStorageAccount -Commit -StorageAccountName $storageAccountName #-Abort will cancel operation

 

Po migracji zasoby będą w Resource Group z suffixem -Migrated. A operacja ta jest niezbędna jeżeli chcemy migrować zasoby z jednej subskrypcji do innej.


Migration from the Classic Model to Azure Resource Manager

Everyone use Azure Resource Manager for several years, but it happens that some resources are still implemented in the Classic model. The following steps migrate the Storage Account from the Classic Model to ARM.

Login-AzureRmAccount

Register-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate

Get-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate #Wait for registered

Add-AzureAccount

Get-AzureSubscription

Select-AzureSubscription -SubscriptionId “subscription id”

Get-AzureStorageAccount

$storageAccountName=”imagesmf”

$validate=Move-AzureStorageAccount -Validate -StorageAccountName $storageAccountName -Verbose

$validate

$validate.ValidationMessages

Move-AzureStorageAccount -Prepare -StorageAccountName $storageAccountName

Move-AzureStorageAccount -Commit -StorageAccountName $storageAccountName #-Abort will cancel operation

After migration, the resources will be in the Resource Group with suffix -Migrated. And this operation is necessary if we want to migrate resources from one Subscription to another.


More info / Więcej informacji

Exchange – naprawa bazy danych – aktualny przewodnik / Exchange Recover Database Complete Fast Guide

Czasami się zdarzy, że nasza baza danych w Exchange nie daje się zamontować, a próby montowania kończą się to komunikatami typu:

  • Operation failed with message: MapiExceptionJetErrorConsistentTimeMismatch: Unable to mount database
  • MapiExceptionJetErrorreadVerify Failure

Do naprawy bazy służy narzędzie eseutil i o dziwo na Internetach, nie ma przewodnika, co zrobić krok po kroku i dość szybko natrafiamy na konieczność użycia komendy /p, która to naprawia bazę danych, ale wraz ze stratą danych i celowo tutaj tego nie opisujemy, jako ostateczność odzyskania danych.

Poniżej co należy wykonać, aby naprawić bazę danych:

eseutil /ml “e:\Exchange\Databases_Logs\Mailbox_DB2″ – ścieżka do katalogu z logami, sprawdza poprawność logów transakcyjnych

eseutil /mh ” e:\Exchange\Databases_Data\Mailbox_DB2″ – ścieżka do plików z bazą danych, wyświetla informacje o bazie danych – zazwyczaj będzie tutaj informacja Dirty SchutDown i trzeba dobrowadzić do stanu Clean ShutDown

 

Naprawa bazy danych:

eseutil /R E00 /l “e:\Exchange\Databases_Logs\Mailbox_DB2″ /d ” e:\Exchange\Databases_Data\Mailbox_DB2″ /S ” e:\Exchange\Databases_Data\Mailbox_DB2″

przełączniki:
/l – ścieżka do katalogu z logami
/d – ścieżka do katalogu z bazą danych – bez podania pliku edb i bez \ na końcu!
/S – miejsce na nowy check point – w miejscu tym nie powinnu być pliku .chk (możemy go skasować bądź przenieść w miejscy, gdyby był z jakiegoś powodu potrzebny).

Po wykonaniu tej operacji logi transakcyjne będą aplikowane do pliku bazy danych. Gdyby skończyło się to komunikatem:

  • JET_errReadVerifyFailure, Checksum error on a database page

Oznacza, to iż plik danych jest uszkodzony i przed opcją /p uchronić nas może tylko odzyskanie go z backupu. Możemy odzyskać go do innej lokalizacji i w samym Exchange wykonać operacje, która wskaże nam nowy plik edb, ale bez kopiowania starego pliku:

Move-DatabasePath -Identity Mailbox_DB2 -EdbFilePath “F:\New_patch\Mailbox_DB2.edb” -ConfigurationOnly

Po odzyskaniu pliku .edb z backupu aplikujemy logi transakcyjne opisaną już metodą i w ten sposób nie powinniśmy stracić żadnych danych! Po wykonaniu powinniśmy móc zamontować bazę danych:

Get-MailboxDatabase |Mount-Database

 

A tak przy okazji logi transakcyjne są kasowane po prawidłowym wykonaniu backupu.

 


 

Sometimes it happens that our Exchange database cannot be mounted, and mounting attempts end with messages like:

  • Operation failed with message: MapiExceptionJetErrorConsistentTimeMismatch: Unable to mount database
  • MapiExceptionJetErrorreadVerify Failure

The eseutil tool is used to repair the database and I noticed that on the Internet, there is no guide what to do step by step. Moreover we can quickly find option to use the /p command that repairs the database, but with the loss of data. It should be used as a last hope option!

What you need to do to repair the database:

eseutil / ml “e: \ Exchange \ Databases_Logs \ Mailbox_DB2” – path to the directory with logs, checks the correctness of transaction logs

eseutil / mh “e: \ Exchange \ Databases_Data \ Mailbox_DB2” – path to files with database, displays information about the database – it will usually be Dirty SchutDown information and need to be brought to the Clean ShutDown state

Database repair:

eseutil / R E00 / l “e: \ Exchange \ Databases_Logs \ Mailbox_DB2” / d “e: \ Exchange \ Databases_Data \ Mailbox_DB2” / S “e: \ Exchange \ Databases_Data \ Mailbox_DB2”

switches:
/ l – directory path with logs
/ d – path to the database directory – without the edb file and without \ at the end!
/ S – a place for a new check point – in this place there should not be a .chk file (we can delete it or move it to a place if it was needed for some reason).

After this operation, transaction logs will be applied to the database file. If it would end with a message:

JET_errReadVerifyFailure, Checksum error on a database page

It means that the data file is damaged and we need to recover it from the backup (or use /p option). We can recover it to a different location and perform operation in that tell Exchange to use a new edb location without copying the old file:

Move-DatabasePath -Identity Mailbox_DB2 -EdbFilePath “F: \ New_patch \ Mailbox_DB2.edb” -ConfigurationOnly

After recovering the .edb file from the backup, we can apply transactional logs with the method already described and in this way we will not lose any data. After execution, we should be able to mount the database:

Get-MailboxDatabase | Mount-Database

Transaction logs are deleted after proper backup.

Aktualizacja Exchange 2010 (i nie tylko) do Office 365 lub Exchange 2016

 

Gdzieniegdzie jeszcze można spotkać Exchange 2010 i klient decyduje się do przeniesienia zasobów do Exchange 2016 lub Office 365. Niby sprawa prosta, ale uwaga Exchange 2010 musi mieć zainstalowanego Service Pack 3 oraz najnowszy Cumulative Update/ Update Rollup. Jako, że Exchange 2010 to produkt już 8 letni pamiętajmy, iż przy aktualizacji powinniśmy:

  1. Przed rozpoczęciu prac powinniśmy wykonać kopie bezpieczeństwa Active Directory, jak i samego Exchange.
  2. Przy instalacji powinniśmy wyłączyć system do backupu (Backup Exec zatrzymujemy serwisy) oraz system antywirusowy (a w szczególności BACKP EXEC – bo otrzymamy błąd):

    Setup cannot continue with the upgrade because the ‘beremote’ () process (ID: 2416) has open files. Close the process and restart Setup.Po operacji pamiętajmy o ich włączeniu.

  3. Przed instalacją poprawek powinniśmy wyłączyć sprawdzanie odwołanych certyfikatów, a więc:
    Internet Explorer =>Internet Options => Advanced
    Security section => Odchaczamy:
    Check for publisher’s certificate revocation
    Check for server certificate revocation

    Po instalacji oczywiście wracamy do stanu pierwotnego.

  4. Service Pack 3 dla Exchange 2010 dostępny tutaj, ściągamy i uruchamiamy, co powoduje i Service Pack rozpakowuje się do wskazanego katalogu
  5. Uruchamiamy aktualizacje schematu z Command Line uruchomionego jako administrator, czyli wydajemy setup.exe /PrepareAD (oczywiście musimy mieć uprawnienia aktualizacji schematu, czyli być w grupie Schema Admins, a jeżeli nam się to nie uda musimy to zrobić z poziomu kontrolera domeny i to nadrzędnego, jeżeli mamy las domen)
  6. Następnie wykonujemy aktualizacje Exchange poprzez wydanie komendy setup.exe /mode:upgrade (z GUI nie zawsze wyskoczy nam menu aktualizacji). Pamiętajmy, aby wykonać to z Command Line uruchomionego jako administrator.
  7. Następnie ściągamy Update Rollup 24 z tej strony.
  8. Samą instalację uruchamiamy z Command Line uruchomionego jako administrator.
  9. Być może zostaniemy poproszeniu o zatrzymanie serwisów (The following applications are using files that need to be updated…)– a więc je zatrzymujemy.

  10. W moim przypadku po instalacji nie wszystkie serwisy zostały uruchomione poprawnie, a więc albo sprawdzamy, które nie są uruchomione i je uruchamiamy lub po prostu restartujemy serwer.
  11. Uwaga w przypadku posiadania DAGa, ta procedura wygląda trochę inaczej i musimy przełączać serwery w tzw. maitenance mode.

 

PS: Exchange 2010 nie możemy migrować bezpośrednio do Exchange 2019, trzeba to zrobić poprzez migracje do 2016.

 

Filtrowanie po użytkownikach i GPO nie działa / User filtering and GPO does not work

Ostatnio się zdziwiłem, iż GPO filtrowane po użytkownikach nie działa. Robiłem to setki razy, i zawsze było OK. A tym razem – nie działa, albo przestało działać.

Przyczyną jest poprawka MS16-072: Security update for Group Policy: June 14, 2016.

Mówiąc krótko – jeżeli mamy politykę GPO i ją filtrujemy np. na grupę użytkowników, to aby polityka ta działała należy pomimo nadania uprawnień dla danej grupy Apply Group Policy i Read – musimy dla Authenticated User ustawić uprawnienie na Read.


I was surprised that GPO filtered by user group does not work. I did it hundreds of times, and it was always OK. And this time – it does not work or it has stopped working.

The reason is MS16-072: Security update for Group Policy: June 14, 2016.

In short, if we have a GPO policy filtered to a group of users, we must set the permission to Read on the Authenticated User, in spite of granting rights to the group of users – Apply Group Policy and Read.

Obejście (Bypass) the PowerShell Execution Policy

Czasami musimy wykonać skrypt PowerShell mimo ustawienia Execution Policy na Restricted (ustawienie domyślne). W Internecie szybko znajdziemy strony typu „15 Ways to Bypass the PowerShell Execution Policy” lecz nie wszystkie metody działają. Dla mnie jedną z metod zawsze działających jest wykonanie:

type script.ps1 |powershell.exe -windowstyle hidden -noprofile –

lub w pliku bat, abyśmy nie widzieli za dużo na ekranie:

@echo off
::run_ps_script.bat
type script.ps1 |powershell.exe -windowstyle hidden -noprofile –

Więcej informacji o wykonywaniu z pozoru niechcianego oprogramowania znajdziecie w moim kursie na Microsoft Virtual Academy – “Wykorzystanie narzędzi hackerskich do audytu środowiska informatycznego“.


Sometimes we have to run the PowerShell script despite the Execution Policy setting on Restricted (default). On the Internet, you will quickly find pages like “15 Ways to Bypass the PowerShell Execution Policy” but not all methods work. For me, one of the methods that are always working is to make:

type script.ps1 |powershell.exe -windowstyle hidden -noprofile –

or in a bat file so that we do not see too much on the screen:

@echo off
:: run_ps_script.bat
type script.ps1 | powershell.exe -windowstyle hidden -noprofile –

More information about performing seemingly unwanted software can be found in my course at the Microsoft Virtual Academy – “Using hack tools for the audit of the IT environment“.

autologon.microsoftazuread-sso.com – Pass-through Authentication

Uwierzytelnianie typu Pass-through Authentication stanowi dość ciekawą alternatywę dla implementacji Active Directory Federation Services. Generalnie polega, na tym iż na kontrolerach domeny powinien być zainstalowany Agent, który pobiera kolejkę uwierzytelniania z chmury, uwierzytelnia użytkownika i tą informacje zwraca do chmury. Do dzisiaj nie spotkałem się z wadami tego rozwiązania, a jest znacznie prostsze i szybsze we wdrożeniu do niedawna mojej ulubionej usługi ADFS.

 

Pewną niedogodnością może być konieczność dodania witryny autologon.microsoftazuread-sso.com do strefy Local Intranet.

Na stronach Microsoft opisywane są różne metody, ale dla mnie najpewniejszą jest użycie skrypt PowerShell (jeżeli będziemy to robić masowo za pomocą GPO, to być może na stacjach będziemy musieli ustawić PowerShell Execution Policy lub skorzystać z metody z następnego posta):


Pass-through Authentication is an interesting alternative to the implementation of Active Directory Federation Services. Generally, it is based that Agents installed on premise servers downloads the authentication requests from the cloud, authenticates the user and returns this information to the cloud. Until today, I have not met with the disadvantages of this solution, and it is much simpler and faster in implementing my favorite ADFS service.

An inconvenience may be the need to add the autologon.microsoftazuread-sso.com site to the Local Intranet zone.

There are various methods described on Microsoft’s pages, but for me the most reliable one is to use the PowerShell script (if we do it massively using GPO, maybe we will have to set the PowerShell Execution Policy – see next post):

 

#Functions from https://github.com/LanLorde/Scritps2/blob/57d714240dc0338da8c7123f33693e092905f53e/PowerShell/LessUsed/OneDriveMapper_v2.53.ps1
function addSiteToIEZoneThroughRegistry{
Param(
[String]$siteUrl,
[Int]$mode=2 #1=intranet, 2=trusted sites
)
try{
$components = $siteUrl.Split(“.”)
$count = $components.Count
if($count -gt 3){
$old = $components
$components = @()
$subDomainString = “”
for($i=0;$i -le $count-3;$i++){
if($i -lt $count-3){$subDomainString += “$($old[$i]).”}else{$subDomainString += “$($old[$i])”}
}
$components += $subDomainString
$components += $old[$count-2]
$components += $old[$count-1]
}
if($count -gt 2){
$res = New-Item “hkcu:\software\microsoft\windows\currentversion\internet settings\zonemap\domains\$($components[1]).$($components[2])” -ErrorAction SilentlyContinue
$res = New-Item “hkcu:\software\microsoft\windows\currentversion\internet settings\zonemap\domains\$($components[1]).$($components[2])\$($components[0])” -ErrorAction SilentlyContinue
$res = New-ItemProperty “hkcu:\software\microsoft\windows\currentversion\internet settings\zonemap\domains\$($components[1]).$($components[2])\$($components[0])” -Name “https” -value $mode -ErrorAction Stop
}else{
$res = New-Item “hkcu:\software\microsoft\windows\currentversion\internet settings\zonemap\domains\$($components[0]).$($components[1])” -ErrorAction SilentlyContinue
$res = New-ItemProperty “hkcu:\software\microsoft\windows\currentversion\internet settings\zonemap\domains\$($components[0]).$($components[1])” -Name “https” -value $mode -ErrorAction Stop
}
}catch{
return -1
}
return $True
}
function checkRegistryKeyValue{
Param(
[String]$basePath,
[String]$entryName
)
try{$value = (Get-ItemProperty -Path “$($basePath)\” -Name $entryName -ErrorAction Stop).$entryName
return $value
}catch{
return -1
}
}
#Main
if((checkRegistryKeyValue -basePath “HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\microsoftazuread-sso.com\autologon” -entryName “https”) -eq 1){
Write-Host “SSO – already exist”
Exit}
if((checkRegistryKeyValue -basePath “HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\microsoftazuread-sso.com\autologon” -entryName “https”) -eq 2){
Write-Host “SSO – already in wrong place”
Write-EventLog -LogName “Application” -Source “Office365” -EventID 666 -EntryType Information -Message “autologon.microsoftazuread-sso.com – exist in Trusted Zones” -Category 1 -RawData 10,20
Exit}
if ((addSiteToIEZoneThroughRegistry -siteUrl “autologon.microsoftazuread-sso.com” -mode 1) -eq $True) {Write-Host “SSO – just enabled”}

Windows Server 2019 Admin Center – rejestracja w Azure celem wykonywania Backupu, Aktualizacji itp. / Windows Server 2019 Admin Center – register in Azure to setup Backup, Updates problems

W przypadku wystąpienia błędu:

Failed to get Azure subscriptions. Detailed error: Failed to acquire token
AADSTS65001: The user or administrator has not consented to use the application with ID ‘1ab6fc84-f0f1-458a-b4de-9289a7ea79df’ named ‘WindowsAdminCenter-https://10.0.0.5’.

Send an interactive authorization request for this user and resource.

Należy – zalogować się do portalu Microsoft Azure, przejść do Azure Active Directory, następnie App Registrations wybrać View all applications, a następnie wybrać aplikację WindowsAdminCenter, przejść na Settings oraz Required Permissions oraz wcisnąć Grant perrmissions.


In case of error:

Failed to get Azure subscriptions. Detailed error: Failed to acquire token
AADSTS65001: The user or administrator has not consented to use the application with ID ‘1ab6fc84-f0f1-458a-b4de-9289a7ea79df’ named ‘WindowsAdminCenter-https://10.0.0.5’.

Send an interactive authorization request for this user and resource.

Please login to portal.azure.com, go to Azure Active Directory, App Registrations, press View all applications. Please locate WindowsAdminCenter application, choose it and press Settings and Required Permissions and press Grant perrmissions

 

Hyper-V – Synthetic FibreChannel Port: Failed to start reserving resources with Error ‘Cannot create a file when that file already exists.

In case of this type of error:

‘VM’ failed to start. (Virtual machine ID C2FBAB4B-29DC-4D70-A32A-B4C4CE3F0065)

‘VM’ Synthetic FibreChannel Port: Failed to start reserving resources with Error ‘Cannot create a file when that file already exists.’ (0x800700B7). (Virtual machine ID C2FBAB4B-29DC-4D70-A32A-B4C4CE3F0065)

‘VM’: NPIV virtual port operation on virtual port (C003FF5F4A830002) failed with an error: The world wide port name already exists on the fabric. (Virtual machine ID C2FBAB4B-29DC-4D70-A32A-B4C4CE3F0065)

‘B1854B54-A335-424B-92C2-3E6DE30F0613’: NPIV virtual port operation for virtual port (C003FF5F4A830003) on physical port (10000090FA922225) failed with an error: (0x800700B7) and NPIV error: (0x00000000). (Virtual machine ID C2FBAB4B-29DC-4D70-A32A-B4C4CE3F0065)

One of the solution is restart Hyper Visor.

Rollup 27 for Azure Site Recovery – to new, but Rollup 26 to old / Aktualizacja Configuration/Process Serwera

I have tried to install Rollup 27 for Azure Site Recovery for Configuration/Process server, but I receive:

The version of Azure Site Recovery Unified Setup installed on this computer is very Old. You first need to update to an intermediate version of the software before you can apply this update.

Then I tried to install Rollup 26 for Azure Site Recovery for Configuration/Process server, but I receive:

Microsoft Azure Site Recovery Unified Setup – Upgrade is not supported as a higher version of the software is already installed.

Solution:

  1. Download Rollup 27 for Azure Site Recovery
  2. Create directory c:\ManualInstall
  3. Extract it using MicrosoftAzureSiteRecoveryUnifiedSetup.exe /q /x:c:\ManualInstall
  4. Inastall manually: CX_THIRDPARTY_SETUP.EXE /VERYSILENT /SUPPRESSMSGBOXES /NORESTART
  5. Install manually: UCX_SERVER_SETUP.EXE /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /UPGRADE
  6. Restart and wait for communication to the Azure Site Recovery
  7. Run original setup of Rollup 27 for Azure Site Recovery – should finish normally.
  8. Update Agents from the portal (normal procedure)

Please remember that update is supported only betwen 4 version, so you need to do intermediate updates.


Aktualizacja Configuration/Process Serwera w usłudze Azure Site Recovery.

Próbowałem zaktualizować Configuration/Process Serwera w usłudze Azure Site Recovery do wersji Rollup 27 i uzyskałem komunikat:

The version of Azure Site Recovery Unified Setup installed on this computer is very Old. You first need to update to an intermediate version of the software before you can apply this update.

Kiedy natomiast chciałem zainstalować wersje Rollup 26 otrzymałem komunikat:

Microsoft Azure Site Recovery Unified Setup – Upgrade is not supported as a higher version of the software is already installed.

Rozwiązanie problemu:

  1. Ściągnąć Rollup 27 for Azure Site Recovery
  2. Utworzyć katalog c:\ManualInstall
  3. Wypakować Rollup 27 używając komendy MicrosoftAzureSiteRecoveryUnifiedSetup.exe /q /x:c:\ManualInstall
  4. Zainstalować komponen ręcznie: CX_THIRDPARTY_SETUP.EXE /VERYSILENT /SUPPRESSMSGBOXES /NORESTART
  5. Zaktualizować component ręcznie: UCX_SERVER_SETUP.EXE /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /UPGRADE
  6. Zrestartować serwer I poczekać na komunikacje z Azure Voult’em
  7. Uruchomić Rollup 27 for Azure Site Recovery jakgdyby nigdy nic, instalacja powinna zakończyć się sukcesem.
  8. Zaktualizować Mobility Agentów z portal Azure – wg. normalnej procedury.

Proszę pamiętać, iż aktualizacje możemy robić tylko 4 wersje do góry, jeżeli przespaliśmy i potrzebujemy aktualizować więcej wersji wówczas należy wykonać aktualizacje pośrednie.


Update Rollup 26 for Azure Site Recovery.
Update Rollup 27 for Azure Site Recovery.

Exchange Hybrid Configuration Step by Step Video

Exchange Hybrid Configuration Wizard 2013, 2016, 2019 step by step guide with migrate and test some mailboxes Include domain verification for Federation Trust and test move some mailbox to the Office 365.


Exchange Hybrid Configuration Wizard 2013, 2016, 2019 krok po kroku wraz migracją wraz zastawieniem Federation Trust i przeniesieniem skrzynek pocztowych.

«< 5 6 7 8 9 >
Projekt i wykonanie: Mobiconnect i fast-sms.net   |    Regulamin
Ta strona korzysta z ciasteczek aby świadczyć usługi na najwyższym poziomie. Dalsze korzystanie ze strony oznacza, że zgadzasz się na ich użycie.Zgoda

Added to Cart

Keep Shopping