Closed stephenwheet closed 3 years ago
I'm able to get the sku by doing this:
(Get-AzDisk -Name (get-azvm -name 'vmname').StorageProfile.OsDisk.Name).Sku.Name
But that seems ugly and I have to do 2 queries instead of just one.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @avirishuv.
Involve Compute team.
@stephenwheet , could you share the log after setting $DebugPreference="Continue"
? It can help to narrow down the issue.
Assigned to Avi.
OK.. so when I did the debug.. it looked like it traced through the entire subscription. It filled up the buffer and then some. I'm using VScode integrated shell and it's not big enough. It was strange. When I tried it and added -ResourceGroupName with the name I got the following
PS C:\Users\swheet\OneDrive\repos\temprepo> (get-azvm -ResourceGroupName PROD-RSG-AIS-MDS -name AIS-PRD-MDS1).StorageProfile.OsDisk.ManagedDisk.StorageAccountType
DEBUG: 5:07:37 PM - GetAzureVMCommand begin processing with ParameterSet 'DefaultParamSet'.
DEBUG: 5:07:37 PM - using account id 'swheet@taos.com'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'swheet@taos.com', environment: 'AzureCloud', tenant: 'eb95d147-2f55-4c53-9425-d5f5c71f4bdc'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: 'eb95d147-2f55-4c53-9425-d5f5c71f4bdc', Endpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.com/eb95d147-2f55-4c53-9425-d5f5c71f4bdc/', CorrelationId: '00000000-0000-0000-0000-000000000000', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: 'eb95d147-2f55-4c53-9425-d5f5c71f4bdc', AdEndpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2311465Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: ADAL PCL.CoreCLR with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2312262Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: ADAL PCL.CoreCLR with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2312939Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: === Token Acquisition started:
CacheType: null
Authentication Target: User
, Authority Host: login.microsoftonline.com
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2313513Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: === Token Acquisition started:
Authority: https://login.microsoftonline.com/eb95d147-2f55-4c53-9425-d5f5c71f4bdc/
Resource: https://management.core.windows.net/
ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
CacheType: null
Authentication Target: User
DEBUG: [ADAL]: Verbose: 2020-10-15T00:07:37.2314909Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: Loading from cache.
DEBUG: [ADAL]: Verbose: 2020-10-15T00:07:37.2315380Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: Loading from cache.
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2332414Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Deserialized 3 items to token cache.
DEBUG: [ADAL]: Verbose: 2020-10-15T00:07:37.2333596Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: Looking up cache for a token...
DEBUG: [ADAL]: Verbose: 2020-10-15T00:07:37.2334048Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: Looking up cache for a token...
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2335063Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: An item matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2335493Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: An item matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2336523Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: 19.735555991666665 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2336966Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: 19.735555991666665 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2337450Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2337861Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2339146Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 10/15/2020 12:27:21 AM +00:00
DEBUG: [ADAL]: Information: 2020-10-15T00:07:37.2339605Z: d75ea18f-d94a-47c2-bb4b-13313e305c43 - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 10/15/2020 12:27:21 AM +00:00Access Token Hash: widdW5hy3fzF6niRJCfBYUjfFdwHdtK/oudIZ6cmz0E=
User id: 65678f57-dc76-4432-b701-b36319c1c258
DEBUG: [Common.Authentication]: Renewing Token with Type: 'Bearer', Expiry: '10/15/2020 00:27:21 +00:00', MultipleResource? 'True', Tenant: 'eb95d147-2f55-4c53-9425-d5f5c71f4bdc', UserId: 'swheet@taos.com'
DEBUG: [Common.Authentication]: User info for token DisplayId: 'swheet@taos.com', Name: , IdProvider: 'https://sts.windows.net/3d19c14a-cc27-4137-8d26-9d3003e15e5f/', Uid: '65678f57-dc76-4432-b701-b36319c1c258'
DEBUG: [Common.Authentication]: Checking token expiration, token expires '10/15/2020 00:27:21 +00:00' Comparing to '10/15/2020 00:07:37 +00:00' With threshold '00:05:00', calculated time until token
expiry: '00:19:44.1320323'
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/4697e9df-5b40-4d70-a029-3ba70bc7acb9/resourceGroups/PROD-RSG-AIS-MDS/providers/Microsoft.Compute/virtualMachines/AIS-PRD-MDS1?api-version=2020-06-01
Headers:
x-ms-client-request-id : 96e349ef-3be6-40c3-9d1a-5a88836fc3e8
Accept-Language : en-US
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Pragma : no-cache
x-ms-ratelimit-remaining-resource: Microsoft.Compute/LowCostGet3Min;3814,Microsoft.Compute/LowCostGet30Min;31628
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-request-id : 8ead1a4d-f35d-4fcb-b7ca-7413589b219d
Server : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11987
x-ms-correlation-request-id : dcbf5196-a978-475b-bc65-900f27a54207
x-ms-routing-request-id : EASTUS:20201015T000737Z:dcbf5196-a978-475b-bc65-900f27a54207
X-Content-Type-Options : nosniff
Date : Thu, 15 Oct 2020 00:07:37 GMT
Body:
{
"name": "AIS-PRD-MDS1",
"id": "/subscriptions/4697e9df-5b40-4d70-a029-3ba70bc7acb9/resourceGroups/PROD-RSG-AIS-MDS/providers/Microsoft.Compute/virtualMachines/AIS-PRD-MDS1",
"type": "Microsoft.Compute/virtualMachines",
"location": "eastus2",
"tags": {
"BuildBy": "Terraform",
"Product": "AIS",
"Owner": "Arkady",
"Environment": "Prod",
"Tier": "DataScience",
"Role": "Primary"
},
"properties": {
"vmId": "401884d0-4eaa-4cfd-a103-4ecf1e163740",
"hardwareProfile": {
"vmSize": "Standard_E32s_v3"
},
"storageProfile": {
"imageReference": {
"publisher": "OpenLogic",
"offer": "CentOS",
"sku": "7.7",
"version": "latest",
"exactVersion": "7.7.201912090"
},
"osDisk": {
"osType": "Linux",
"name": "AIS-PRD-MDS1_OsDisk_1_930cc82c98ba48c6a3ca8796fcac1d4d",
"createOption": "FromImage",
"caching": "ReadWrite",
"writeAcceleratorEnabled": false,
"managedDisk": {
"id": "/subscriptions/4697e9df-5b40-4d70-a029-3ba70bc7acb9/resourceGroups/PROD-RSG-AIS-MDS/providers/Microsoft.Compute/disks/AIS-PRD-MDS1_OsDisk_1_930cc82c98ba48c6a3ca8796fcac1d4d"
}
},
"dataDisks": []
},
"osProfile": {
"computerName": "AIS-PRD-MDS1",
"adminUsername": "dtroot",
"linuxConfiguration": {
"disablePasswordAuthentication": false,
"ssh": {
"publicKeys": []
},
"provisionVMAgent": true,
"patchSettings": {
"patchMode": "ImageDefault"
}
},
"secrets": [],
"allowExtensionOperations": true,
"requireGuestProvisionSignal": true
},
"networkProfile": {
"networkInterfaces": [
{
"id": "/subscriptions/4697e9df-5b40-4d70-a029-3ba70bc7acb9/resourceGroups/PROD-RSG-AIS-MDS/providers/Microsoft.Network/networkInterfaces/AIS-PRD-MDS1-NIC1"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "https://es2qadiagshellabc9.blob.core.windows.net/"
}
},
"provisioningState": "Succeeded",
"priority": "Regular"
}
}
DEBUG: AzureQoSEvent: CommandName - Get-AzVM; IsSuccess - True; Duration - 00:00:01.5271688;
DEBUG: Finish sending metric.
DEBUG: 5:07:39 PM - GetAzureVMCommand end processing.
PS C:\Users\swheet\OneDrive\repos\temprepo>
Without the -resourcegroupname it goes wild .. either way same response .. doesn't give it to me if powered off.
BTW .. if I specify the -resourcegroupname .. the request is like 100x faster and so is " -status". That should be mentioned somewhere.
I was able to repro that for deallocated VMs, storage account type is not returned, while it works for running VM. Marking this as a bug and assigning to @bilaakpan-ms to investigate based on difference between Az 4.7.0 and Az 4.8.0 versions.
Thanks .. any comment on the part where I said "BTW .. if I specify the -resourcegroupname .. the request is like 100x faster and so is " -status". That should be mentioned somewhere." ?
It seems like if I don't specify the resource group it does pulls all vm's and their status from all resourcegroups in the subscription.. you would think that you would get the VMnames .. parse the resource group and then run the process (like -status) .. it seems to do things like -status on all vms (if I don't specify the RG) then only returns for the one VM I specify.. horribly inefficient (I don't know if that's what it's doing but it seems like it).
I've created a work item to track this bug. We will pick it up when we have bandwidth.
hi @stephenwheet apologies for the delay here. This behavior is actually by design: the StorageAccountType is not returned by the VM GET API when the VM is deallocated. This is because this property can be modified by the user when the VM is in a deallocated state. Hence, when the VM comes back to a Running state, that's when the latest value is picked up and returned.
Hope this helps, please let us know if you have any follow up questions.
Closing this out because the behavior is by design.
Description
When using get-azvm I can't get the managed OS disk storage type if the VM is deallocated. If I look in the portal it will tell me the storage type but not in powershell. This was working with Az v4.7.0 but it's not working with Az 4.8.0 (and I just updated today).
Steps to reproduce
Environment data
Module versions
Debug output
Error output