Azure VM creation date
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Is there any Management API to find Azure VM creation date? There is Get hosted service properties API for Cloud service creation date but we are not able to find out Azure VM creation date.
azure
add a comment |
Is there any Management API to find Azure VM creation date? There is Get hosted service properties API for Cloud service creation date but we are not able to find out Azure VM creation date.
azure
add a comment |
Is there any Management API to find Azure VM creation date? There is Get hosted service properties API for Cloud service creation date but we are not able to find out Azure VM creation date.
azure
Is there any Management API to find Azure VM creation date? There is Get hosted service properties API for Cloud service creation date but we are not able to find out Azure VM creation date.
azure
azure
asked Apr 6 '13 at 9:20
user2044374user2044374
112212
112212
add a comment |
add a comment |
6 Answers
6
active
oldest
votes
You can see the creation date was included in disk name on the Dashboard.
Also you could use Azure Powershell Command to retrieve this:
Get-AzureVM -ServiceName myubuntu1 | Get-AzureOSDisk | select MediaLink
add a comment |
We can retrieve operation system disk file creation time in Blob storage which equivalent to virtual machine creation time. see more https://social.msdn.microsoft.com/forums/azure/en-US/3da7750a-1a7d-4c62-b58a-a4b427b2520d/get-azure-vm-creationprovision-date
add a comment |
2016 update: There still isn't a way to quickly get VM creation date in a reliable way (no, the date portion of the disk name is not reliable).
add a comment |
I recently wrote a function for this sort of thing you may find useful.
The function only requires your tenantID and an identity that has the right permissions and will return the data you're after regarding creation date of Azure VMs, the resource groups they are in, OS and SKU.
Here is the function:
Function Get-AZVMCreated
<#
.SYNOPSIS
Function "Get-AZVMCreated" will connect to a given tenant and parse through the subscriptions and output Azure VM details based on creation date.
.DESCRIPTION
Author: Pwd9000 (Pwd9000@hotmail.co.uk)
PSVersion: 5.1
The user must specify the TenantId when using this function.
The function will request access credentials and connect to the given Tenant.
Granted the identity used has the required access permisson the function will parse through all subscriptions
and gather data on Azure Vms based on the creation date.
.EXAMPLE
Get-AZVMCreated -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
.PARAMETER TenantId
A valid Tenant Id object. e.g: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" <String>
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
HelpMessage = 'Please specify the tenant id? e.g: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"')]
[string]$TenantId
)
#------------------------------------------------Obtain Credentials for Session------------------------------------------------------------
$Credential = Get-Credential
#---------------------------------------------Get all Subscription Ids for given Tenant----------------------------------------------------
$SubscriptionIds = (Get-AzureRmSubscription -TenantId $TenantId).Id
#-------------------------------------------------Create Empty Table to capture data-------------------------------------------------------
$Table = @()
Foreach ($Subscription in $SubscriptionIds)
Select-Object Name, ManagedBy, Resourcegroupname, TimeCreated
$UniqueVMs = $Table
You can then call and use the function like this for example:
$TenantId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$AZVMsAll = Get-AZVMCreated -TenantId $TenantId | sort-object -property Created
$Win10 = $AZVMsAll | Where-Object $_.SKU -like "*Windows-10*" | sort-object -property Created
$Win8 = $AZVMsAll | Where-Object $_.SKU -like "*Win81*" | sort-object -property Created
$Win7 = $AZVMsAll | Where-Object $_.SKU -like "*Win7*" | sort-object -property Created
$Server2008R2 = $AZVMsAll | Where-Object $_.SKU -like "*2008-R2*" | sort-object -property Created
$Server2012R2 = $AZVMsAll | Where-Object $_.SKU -like "*2012-R2*" | sort-object -property Created
$Server2016 = $AZVMsAll | Where-Object $_.SKU -like "*2016*" | sort-object -property Created
$RHEL = $AZVMsAll | Where-Object $_.OperatingSystem -like "*RHEL*" | sort-object -property Created
$Ubuntu = $AZVMsAll | Where-Object $_.OperatingSystem -like "*Ubuntu*" | sort-object -property Created
$Centos = $AZVMsAll | Where-Object $_.OperatingSystem -like "*Centos*" | sort-object -property Created
$AZVMsAll
In the above example you can also call other versions of OS's using the variable defined e.g. For all Win7 machines you can call variable $Win7 etc etc etc...
Note: I would also recommend having some sort of naming convention for the AzureRmDisk "name" parameter of the VM to contain some sort of refference to the purpose of the disk, and filter on the OSDisk e.g: Where-Object $_.name -like "*osdisk*" (add the filter on line 34 in the function). This will greatly reduce the function looking through all disks and will target the OS disk only which is what we are after.
– Pwd9000
Nov 16 '18 at 23:53
add a comment |
Use below az commands to get the disk creation date...From this OS Disk creation, we can find the VM provision date:
diskquery='[*].Resourceid:id, name:name, timeCreated:timeCreated'
az disk list --query "$diskquery"
add a comment |
There isn't a way to get this via the Windows Azure APIs that I'm aware of. Are you trying to remotely get this value, or get it for use on the instance?
If you are on the instance you might try to get it based on WMI. Here it is in PowerShell, but you can adapt to C#, VB.NET, or another Scripting language that can get at the WMI info.
[reflection.Assembly]::LoadWithPartialName("system.management")
$wmiSearch = new-object -type System.Management.ManagementObjectSearcher -Arg "Select * from Win32_OperatingSystem"
$data = $wmiSearch.Get()
[System.Management.ManagementDateTimeConverter]::ToDateTime($data.InstallDate)
I tried this on an Azure VM and it returned basically the creation of the VM to me. You might want to test this result over time though. Also, this would only get you the time in which the VM was actually spun up. So, if you have an instance A that is running along well, then the hard drive faults on it and the Fabric Controller moves the instance to another location in the DC and spins it back up then the install date will likely be the time it was moved. This may be exactly what you are looking for, or maybe not depending on your requirements.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f15849126%2fazure-vm-creation-date%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can see the creation date was included in disk name on the Dashboard.
Also you could use Azure Powershell Command to retrieve this:
Get-AzureVM -ServiceName myubuntu1 | Get-AzureOSDisk | select MediaLink
add a comment |
You can see the creation date was included in disk name on the Dashboard.
Also you could use Azure Powershell Command to retrieve this:
Get-AzureVM -ServiceName myubuntu1 | Get-AzureOSDisk | select MediaLink
add a comment |
You can see the creation date was included in disk name on the Dashboard.
Also you could use Azure Powershell Command to retrieve this:
Get-AzureVM -ServiceName myubuntu1 | Get-AzureOSDisk | select MediaLink
You can see the creation date was included in disk name on the Dashboard.
Also you could use Azure Powershell Command to retrieve this:
Get-AzureVM -ServiceName myubuntu1 | Get-AzureOSDisk | select MediaLink
edited Jan 22 '16 at 3:00
answered Jan 21 '16 at 9:33
StevenSteven
68439
68439
add a comment |
add a comment |
We can retrieve operation system disk file creation time in Blob storage which equivalent to virtual machine creation time. see more https://social.msdn.microsoft.com/forums/azure/en-US/3da7750a-1a7d-4c62-b58a-a4b427b2520d/get-azure-vm-creationprovision-date
add a comment |
We can retrieve operation system disk file creation time in Blob storage which equivalent to virtual machine creation time. see more https://social.msdn.microsoft.com/forums/azure/en-US/3da7750a-1a7d-4c62-b58a-a4b427b2520d/get-azure-vm-creationprovision-date
add a comment |
We can retrieve operation system disk file creation time in Blob storage which equivalent to virtual machine creation time. see more https://social.msdn.microsoft.com/forums/azure/en-US/3da7750a-1a7d-4c62-b58a-a4b427b2520d/get-azure-vm-creationprovision-date
We can retrieve operation system disk file creation time in Blob storage which equivalent to virtual machine creation time. see more https://social.msdn.microsoft.com/forums/azure/en-US/3da7750a-1a7d-4c62-b58a-a4b427b2520d/get-azure-vm-creationprovision-date
answered Aug 7 '15 at 9:17
Xiao WangXiao Wang
112
112
add a comment |
add a comment |
2016 update: There still isn't a way to quickly get VM creation date in a reliable way (no, the date portion of the disk name is not reliable).
add a comment |
2016 update: There still isn't a way to quickly get VM creation date in a reliable way (no, the date portion of the disk name is not reliable).
add a comment |
2016 update: There still isn't a way to quickly get VM creation date in a reliable way (no, the date portion of the disk name is not reliable).
2016 update: There still isn't a way to quickly get VM creation date in a reliable way (no, the date portion of the disk name is not reliable).
answered Jan 27 '16 at 19:44
jdc0589jdc0589
5,48652638
5,48652638
add a comment |
add a comment |
I recently wrote a function for this sort of thing you may find useful.
The function only requires your tenantID and an identity that has the right permissions and will return the data you're after regarding creation date of Azure VMs, the resource groups they are in, OS and SKU.
Here is the function:
Function Get-AZVMCreated
<#
.SYNOPSIS
Function "Get-AZVMCreated" will connect to a given tenant and parse through the subscriptions and output Azure VM details based on creation date.
.DESCRIPTION
Author: Pwd9000 (Pwd9000@hotmail.co.uk)
PSVersion: 5.1
The user must specify the TenantId when using this function.
The function will request access credentials and connect to the given Tenant.
Granted the identity used has the required access permisson the function will parse through all subscriptions
and gather data on Azure Vms based on the creation date.
.EXAMPLE
Get-AZVMCreated -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
.PARAMETER TenantId
A valid Tenant Id object. e.g: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" <String>
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
HelpMessage = 'Please specify the tenant id? e.g: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"')]
[string]$TenantId
)
#------------------------------------------------Obtain Credentials for Session------------------------------------------------------------
$Credential = Get-Credential
#---------------------------------------------Get all Subscription Ids for given Tenant----------------------------------------------------
$SubscriptionIds = (Get-AzureRmSubscription -TenantId $TenantId).Id
#-------------------------------------------------Create Empty Table to capture data-------------------------------------------------------
$Table = @()
Foreach ($Subscription in $SubscriptionIds)
Select-Object Name, ManagedBy, Resourcegroupname, TimeCreated
$UniqueVMs = $Table
You can then call and use the function like this for example:
$TenantId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$AZVMsAll = Get-AZVMCreated -TenantId $TenantId | sort-object -property Created
$Win10 = $AZVMsAll | Where-Object $_.SKU -like "*Windows-10*" | sort-object -property Created
$Win8 = $AZVMsAll | Where-Object $_.SKU -like "*Win81*" | sort-object -property Created
$Win7 = $AZVMsAll | Where-Object $_.SKU -like "*Win7*" | sort-object -property Created
$Server2008R2 = $AZVMsAll | Where-Object $_.SKU -like "*2008-R2*" | sort-object -property Created
$Server2012R2 = $AZVMsAll | Where-Object $_.SKU -like "*2012-R2*" | sort-object -property Created
$Server2016 = $AZVMsAll | Where-Object $_.SKU -like "*2016*" | sort-object -property Created
$RHEL = $AZVMsAll | Where-Object $_.OperatingSystem -like "*RHEL*" | sort-object -property Created
$Ubuntu = $AZVMsAll | Where-Object $_.OperatingSystem -like "*Ubuntu*" | sort-object -property Created
$Centos = $AZVMsAll | Where-Object $_.OperatingSystem -like "*Centos*" | sort-object -property Created
$AZVMsAll
In the above example you can also call other versions of OS's using the variable defined e.g. For all Win7 machines you can call variable $Win7 etc etc etc...
Note: I would also recommend having some sort of naming convention for the AzureRmDisk "name" parameter of the VM to contain some sort of refference to the purpose of the disk, and filter on the OSDisk e.g: Where-Object $_.name -like "*osdisk*" (add the filter on line 34 in the function). This will greatly reduce the function looking through all disks and will target the OS disk only which is what we are after.
– Pwd9000
Nov 16 '18 at 23:53
add a comment |
I recently wrote a function for this sort of thing you may find useful.
The function only requires your tenantID and an identity that has the right permissions and will return the data you're after regarding creation date of Azure VMs, the resource groups they are in, OS and SKU.
Here is the function:
Function Get-AZVMCreated
<#
.SYNOPSIS
Function "Get-AZVMCreated" will connect to a given tenant and parse through the subscriptions and output Azure VM details based on creation date.
.DESCRIPTION
Author: Pwd9000 (Pwd9000@hotmail.co.uk)
PSVersion: 5.1
The user must specify the TenantId when using this function.
The function will request access credentials and connect to the given Tenant.
Granted the identity used has the required access permisson the function will parse through all subscriptions
and gather data on Azure Vms based on the creation date.
.EXAMPLE
Get-AZVMCreated -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
.PARAMETER TenantId
A valid Tenant Id object. e.g: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" <String>
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
HelpMessage = 'Please specify the tenant id? e.g: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"')]
[string]$TenantId
)
#------------------------------------------------Obtain Credentials for Session------------------------------------------------------------
$Credential = Get-Credential
#---------------------------------------------Get all Subscription Ids for given Tenant----------------------------------------------------
$SubscriptionIds = (Get-AzureRmSubscription -TenantId $TenantId).Id
#-------------------------------------------------Create Empty Table to capture data-------------------------------------------------------
$Table = @()
Foreach ($Subscription in $SubscriptionIds)
Select-Object Name, ManagedBy, Resourcegroupname, TimeCreated
$UniqueVMs = $Table
You can then call and use the function like this for example:
$TenantId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$AZVMsAll = Get-AZVMCreated -TenantId $TenantId | sort-object -property Created
$Win10 = $AZVMsAll | Where-Object $_.SKU -like "*Windows-10*" | sort-object -property Created
$Win8 = $AZVMsAll | Where-Object $_.SKU -like "*Win81*" | sort-object -property Created
$Win7 = $AZVMsAll | Where-Object $_.SKU -like "*Win7*" | sort-object -property Created
$Server2008R2 = $AZVMsAll | Where-Object $_.SKU -like "*2008-R2*" | sort-object -property Created
$Server2012R2 = $AZVMsAll | Where-Object $_.SKU -like "*2012-R2*" | sort-object -property Created
$Server2016 = $AZVMsAll | Where-Object $_.SKU -like "*2016*" | sort-object -property Created
$RHEL = $AZVMsAll | Where-Object $_.OperatingSystem -like "*RHEL*" | sort-object -property Created
$Ubuntu = $AZVMsAll | Where-Object $_.OperatingSystem -like "*Ubuntu*" | sort-object -property Created
$Centos = $AZVMsAll | Where-Object $_.OperatingSystem -like "*Centos*" | sort-object -property Created
$AZVMsAll
In the above example you can also call other versions of OS's using the variable defined e.g. For all Win7 machines you can call variable $Win7 etc etc etc...
Note: I would also recommend having some sort of naming convention for the AzureRmDisk "name" parameter of the VM to contain some sort of refference to the purpose of the disk, and filter on the OSDisk e.g: Where-Object $_.name -like "*osdisk*" (add the filter on line 34 in the function). This will greatly reduce the function looking through all disks and will target the OS disk only which is what we are after.
– Pwd9000
Nov 16 '18 at 23:53
add a comment |
I recently wrote a function for this sort of thing you may find useful.
The function only requires your tenantID and an identity that has the right permissions and will return the data you're after regarding creation date of Azure VMs, the resource groups they are in, OS and SKU.
Here is the function:
Function Get-AZVMCreated
<#
.SYNOPSIS
Function "Get-AZVMCreated" will connect to a given tenant and parse through the subscriptions and output Azure VM details based on creation date.
.DESCRIPTION
Author: Pwd9000 (Pwd9000@hotmail.co.uk)
PSVersion: 5.1
The user must specify the TenantId when using this function.
The function will request access credentials and connect to the given Tenant.
Granted the identity used has the required access permisson the function will parse through all subscriptions
and gather data on Azure Vms based on the creation date.
.EXAMPLE
Get-AZVMCreated -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
.PARAMETER TenantId
A valid Tenant Id object. e.g: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" <String>
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
HelpMessage = 'Please specify the tenant id? e.g: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"')]
[string]$TenantId
)
#------------------------------------------------Obtain Credentials for Session------------------------------------------------------------
$Credential = Get-Credential
#---------------------------------------------Get all Subscription Ids for given Tenant----------------------------------------------------
$SubscriptionIds = (Get-AzureRmSubscription -TenantId $TenantId).Id
#-------------------------------------------------Create Empty Table to capture data-------------------------------------------------------
$Table = @()
Foreach ($Subscription in $SubscriptionIds)
Select-Object Name, ManagedBy, Resourcegroupname, TimeCreated
$UniqueVMs = $Table
You can then call and use the function like this for example:
$TenantId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$AZVMsAll = Get-AZVMCreated -TenantId $TenantId | sort-object -property Created
$Win10 = $AZVMsAll | Where-Object $_.SKU -like "*Windows-10*" | sort-object -property Created
$Win8 = $AZVMsAll | Where-Object $_.SKU -like "*Win81*" | sort-object -property Created
$Win7 = $AZVMsAll | Where-Object $_.SKU -like "*Win7*" | sort-object -property Created
$Server2008R2 = $AZVMsAll | Where-Object $_.SKU -like "*2008-R2*" | sort-object -property Created
$Server2012R2 = $AZVMsAll | Where-Object $_.SKU -like "*2012-R2*" | sort-object -property Created
$Server2016 = $AZVMsAll | Where-Object $_.SKU -like "*2016*" | sort-object -property Created
$RHEL = $AZVMsAll | Where-Object $_.OperatingSystem -like "*RHEL*" | sort-object -property Created
$Ubuntu = $AZVMsAll | Where-Object $_.OperatingSystem -like "*Ubuntu*" | sort-object -property Created
$Centos = $AZVMsAll | Where-Object $_.OperatingSystem -like "*Centos*" | sort-object -property Created
$AZVMsAll
In the above example you can also call other versions of OS's using the variable defined e.g. For all Win7 machines you can call variable $Win7 etc etc etc...
I recently wrote a function for this sort of thing you may find useful.
The function only requires your tenantID and an identity that has the right permissions and will return the data you're after regarding creation date of Azure VMs, the resource groups they are in, OS and SKU.
Here is the function:
Function Get-AZVMCreated
<#
.SYNOPSIS
Function "Get-AZVMCreated" will connect to a given tenant and parse through the subscriptions and output Azure VM details based on creation date.
.DESCRIPTION
Author: Pwd9000 (Pwd9000@hotmail.co.uk)
PSVersion: 5.1
The user must specify the TenantId when using this function.
The function will request access credentials and connect to the given Tenant.
Granted the identity used has the required access permisson the function will parse through all subscriptions
and gather data on Azure Vms based on the creation date.
.EXAMPLE
Get-AZVMCreated -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
.PARAMETER TenantId
A valid Tenant Id object. e.g: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" <String>
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
HelpMessage = 'Please specify the tenant id? e.g: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"')]
[string]$TenantId
)
#------------------------------------------------Obtain Credentials for Session------------------------------------------------------------
$Credential = Get-Credential
#---------------------------------------------Get all Subscription Ids for given Tenant----------------------------------------------------
$SubscriptionIds = (Get-AzureRmSubscription -TenantId $TenantId).Id
#-------------------------------------------------Create Empty Table to capture data-------------------------------------------------------
$Table = @()
Foreach ($Subscription in $SubscriptionIds)
Select-Object Name, ManagedBy, Resourcegroupname, TimeCreated
$UniqueVMs = $Table
You can then call and use the function like this for example:
$TenantId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$AZVMsAll = Get-AZVMCreated -TenantId $TenantId | sort-object -property Created
$Win10 = $AZVMsAll | Where-Object $_.SKU -like "*Windows-10*" | sort-object -property Created
$Win8 = $AZVMsAll | Where-Object $_.SKU -like "*Win81*" | sort-object -property Created
$Win7 = $AZVMsAll | Where-Object $_.SKU -like "*Win7*" | sort-object -property Created
$Server2008R2 = $AZVMsAll | Where-Object $_.SKU -like "*2008-R2*" | sort-object -property Created
$Server2012R2 = $AZVMsAll | Where-Object $_.SKU -like "*2012-R2*" | sort-object -property Created
$Server2016 = $AZVMsAll | Where-Object $_.SKU -like "*2016*" | sort-object -property Created
$RHEL = $AZVMsAll | Where-Object $_.OperatingSystem -like "*RHEL*" | sort-object -property Created
$Ubuntu = $AZVMsAll | Where-Object $_.OperatingSystem -like "*Ubuntu*" | sort-object -property Created
$Centos = $AZVMsAll | Where-Object $_.OperatingSystem -like "*Centos*" | sort-object -property Created
$AZVMsAll
In the above example you can also call other versions of OS's using the variable defined e.g. For all Win7 machines you can call variable $Win7 etc etc etc...
edited Nov 14 '18 at 14:01
answered Nov 13 '18 at 20:17
Pwd9000Pwd9000
417
417
Note: I would also recommend having some sort of naming convention for the AzureRmDisk "name" parameter of the VM to contain some sort of refference to the purpose of the disk, and filter on the OSDisk e.g: Where-Object $_.name -like "*osdisk*" (add the filter on line 34 in the function). This will greatly reduce the function looking through all disks and will target the OS disk only which is what we are after.
– Pwd9000
Nov 16 '18 at 23:53
add a comment |
Note: I would also recommend having some sort of naming convention for the AzureRmDisk "name" parameter of the VM to contain some sort of refference to the purpose of the disk, and filter on the OSDisk e.g: Where-Object $_.name -like "*osdisk*" (add the filter on line 34 in the function). This will greatly reduce the function looking through all disks and will target the OS disk only which is what we are after.
– Pwd9000
Nov 16 '18 at 23:53
Note: I would also recommend having some sort of naming convention for the AzureRmDisk "name" parameter of the VM to contain some sort of refference to the purpose of the disk, and filter on the OSDisk e.g: Where-Object $_.name -like "*osdisk*" (add the filter on line 34 in the function). This will greatly reduce the function looking through all disks and will target the OS disk only which is what we are after.
– Pwd9000
Nov 16 '18 at 23:53
Note: I would also recommend having some sort of naming convention for the AzureRmDisk "name" parameter of the VM to contain some sort of refference to the purpose of the disk, and filter on the OSDisk e.g: Where-Object $_.name -like "*osdisk*" (add the filter on line 34 in the function). This will greatly reduce the function looking through all disks and will target the OS disk only which is what we are after.
– Pwd9000
Nov 16 '18 at 23:53
add a comment |
Use below az commands to get the disk creation date...From this OS Disk creation, we can find the VM provision date:
diskquery='[*].Resourceid:id, name:name, timeCreated:timeCreated'
az disk list --query "$diskquery"
add a comment |
Use below az commands to get the disk creation date...From this OS Disk creation, we can find the VM provision date:
diskquery='[*].Resourceid:id, name:name, timeCreated:timeCreated'
az disk list --query "$diskquery"
add a comment |
Use below az commands to get the disk creation date...From this OS Disk creation, we can find the VM provision date:
diskquery='[*].Resourceid:id, name:name, timeCreated:timeCreated'
az disk list --query "$diskquery"
Use below az commands to get the disk creation date...From this OS Disk creation, we can find the VM provision date:
diskquery='[*].Resourceid:id, name:name, timeCreated:timeCreated'
az disk list --query "$diskquery"
edited Feb 13 at 23:50
Elletlar
1,86441625
1,86441625
answered Feb 13 at 17:19
GopiGopi
1
1
add a comment |
add a comment |
There isn't a way to get this via the Windows Azure APIs that I'm aware of. Are you trying to remotely get this value, or get it for use on the instance?
If you are on the instance you might try to get it based on WMI. Here it is in PowerShell, but you can adapt to C#, VB.NET, or another Scripting language that can get at the WMI info.
[reflection.Assembly]::LoadWithPartialName("system.management")
$wmiSearch = new-object -type System.Management.ManagementObjectSearcher -Arg "Select * from Win32_OperatingSystem"
$data = $wmiSearch.Get()
[System.Management.ManagementDateTimeConverter]::ToDateTime($data.InstallDate)
I tried this on an Azure VM and it returned basically the creation of the VM to me. You might want to test this result over time though. Also, this would only get you the time in which the VM was actually spun up. So, if you have an instance A that is running along well, then the hard drive faults on it and the Fabric Controller moves the instance to another location in the DC and spins it back up then the install date will likely be the time it was moved. This may be exactly what you are looking for, or maybe not depending on your requirements.
add a comment |
There isn't a way to get this via the Windows Azure APIs that I'm aware of. Are you trying to remotely get this value, or get it for use on the instance?
If you are on the instance you might try to get it based on WMI. Here it is in PowerShell, but you can adapt to C#, VB.NET, or another Scripting language that can get at the WMI info.
[reflection.Assembly]::LoadWithPartialName("system.management")
$wmiSearch = new-object -type System.Management.ManagementObjectSearcher -Arg "Select * from Win32_OperatingSystem"
$data = $wmiSearch.Get()
[System.Management.ManagementDateTimeConverter]::ToDateTime($data.InstallDate)
I tried this on an Azure VM and it returned basically the creation of the VM to me. You might want to test this result over time though. Also, this would only get you the time in which the VM was actually spun up. So, if you have an instance A that is running along well, then the hard drive faults on it and the Fabric Controller moves the instance to another location in the DC and spins it back up then the install date will likely be the time it was moved. This may be exactly what you are looking for, or maybe not depending on your requirements.
add a comment |
There isn't a way to get this via the Windows Azure APIs that I'm aware of. Are you trying to remotely get this value, or get it for use on the instance?
If you are on the instance you might try to get it based on WMI. Here it is in PowerShell, but you can adapt to C#, VB.NET, or another Scripting language that can get at the WMI info.
[reflection.Assembly]::LoadWithPartialName("system.management")
$wmiSearch = new-object -type System.Management.ManagementObjectSearcher -Arg "Select * from Win32_OperatingSystem"
$data = $wmiSearch.Get()
[System.Management.ManagementDateTimeConverter]::ToDateTime($data.InstallDate)
I tried this on an Azure VM and it returned basically the creation of the VM to me. You might want to test this result over time though. Also, this would only get you the time in which the VM was actually spun up. So, if you have an instance A that is running along well, then the hard drive faults on it and the Fabric Controller moves the instance to another location in the DC and spins it back up then the install date will likely be the time it was moved. This may be exactly what you are looking for, or maybe not depending on your requirements.
There isn't a way to get this via the Windows Azure APIs that I'm aware of. Are you trying to remotely get this value, or get it for use on the instance?
If you are on the instance you might try to get it based on WMI. Here it is in PowerShell, but you can adapt to C#, VB.NET, or another Scripting language that can get at the WMI info.
[reflection.Assembly]::LoadWithPartialName("system.management")
$wmiSearch = new-object -type System.Management.ManagementObjectSearcher -Arg "Select * from Win32_OperatingSystem"
$data = $wmiSearch.Get()
[System.Management.ManagementDateTimeConverter]::ToDateTime($data.InstallDate)
I tried this on an Azure VM and it returned basically the creation of the VM to me. You might want to test this result over time though. Also, this would only get you the time in which the VM was actually spun up. So, if you have an instance A that is running along well, then the hard drive faults on it and the Fabric Controller moves the instance to another location in the DC and spins it back up then the install date will likely be the time it was moved. This may be exactly what you are looking for, or maybe not depending on your requirements.
answered Apr 6 '13 at 12:44
MikeWoMikeWo
9,83612636
9,83612636
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f15849126%2fazure-vm-creation-date%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown