Skip to content
Azureactivation

Azureactivation

Issue with azure activation

To resolve error

“Windows Server 2022 Datacenter Azure Edition VM has

been deactivated because you are not running on Azure or a

supported Azure Stack hypervisor. or that you have not

enabled Azure benefits on the supported Azure Stack To

enable Azure benefits, go to your duster settings in Windows

Admin Center > Enable Azure benefits.”

Carry out the following:

Check if communication to IMDS is possible

Please confirm that communication with IMDS is possible by executing the following commands.

Command (Please execute one line at a time):

1
2
3
4
$Proxy=New-object System.Net.WebProxy
$WebSession=new-object Microsoft.PowerShell.Commands.WebRequestSession
$WebSession.Proxy=$Proxy
Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri "http://169.254.169.254/metadata/instance?api-version=2021-02-01" -WebSession $WebSession

If the last Invoke-RestMethod command is successfully executed, the following results will be displayed in PowerShell.

| —- compute ——- @{azEnvironment=AzurePublicCloud; customData=; evictionPolicy=; isHostCompatibilityLayerVm=false; licenseType=; locat… —-  |

If the above command fails, the Firewall or security software on your OS may be blocking communication to IMDS.

If the above command outputs the result as expected, please proceed to step 2.

2.Verifying the Verifiability of IMDS Server Certificates

2.1 Verification of IMDS server certificate

Please check if the IMDS certificate can be verified by using the following command.

1
2
3
4
5
6
7
$Proxy=New-object System.Net.WebProxy
$WebSession=new-object Microsoft.PowerShell.Commands.WebRequestSession
$WebSession.Proxy=$Proxy
$attestedDoc = Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri http://169.254.169.254/metadata/attested/document?api-version=2020-09-01 -WebSession $WebSession
     $signature = [$cert = [System.Security.Cryptography.X509Certificates.X509Certificate2](System.Convert]::FromBase64String($attestedDoc.signature))($signature)
$chain = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Chain
$chain.Build($cert)

If the certificate fails to validate, you will see False after the last $chain.Build($cert) command is executed,

Please proceed to 2.2 or later.

If the output is True, please report this to microsoft support.

2.2 Checking the certificate used in IMDS

The following commands are used to obtain information on certificates used in IMDS.

Command (Please execute one line at a time):

1
2
3
4
5
6
$Proxy=New-object System.Net.WebProxy
$WebSession=new-object Microsoft.PowerShell.Commands.WebRequestSession
$WebSession.Proxy=$Proxy
$attestedDoc = Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri http://169.254.169.254/metadata/attested/document?api-version=2020-09-01 -WebSession $WebSession
$signature = [$cert = [System.Security.Cryptography.X509Certificates.X509Certificate2](System.Convert]::FromBase64String($attestedDoc.signature))($signature)
[$cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType](System.IO.File]::WriteAllBytes("C:\IMDS.cer",)::Cert))

If all commands are executed successfully, a file named IMDS.cer will be created directly under the C drive.

Open IMDS.cer and check the CN name corresponding to “Issuer” in the “Details” tab.

After confirming the CN name, download the certificate corresponding to the CN name from the following page.

Reference: Azure Certificate Authority details | Microsoft Learn

2.3 Import the downloaded certificate

Double-click the downloaded certificate file on the server and select “Install Certificate

Select “Install Certificate”.

Select “Local Computer” and select Next.

Select “Place all certificates in the following store”, select “Intermediate Certificate Authority” from “Browse”, click OK, and then select “Next”.

5.Finally, click “Finish.

2.4 Perform OS reactivation

Open a command prompt with administrator privileges and execute the following command

Command:

1
schtasks /RUN /TN "\Microsoft\Windows\Clip\LicenseImdsIntegration"

2.5 Checking the activation

Open “Settings” in the Windows menu and go to “Update and Security” to check the “License Activation” menu.

On the Activation screen, under “Activation,” the message “Windows has been activated using your organization’s license activation service. "