azure-powershell
azure-powershell copied to clipboard
Get-azResource |select *, missing more that just createTime values
Description
az resource list command, The values from the Json output should be the same output when I run > Get-azResource |select * It is not the same values, alot of values are missing. Json output from cli az resource list : { "changedTime": has Value, "createdTime": has Value, "extendedLocation": null, "id": has Value, "identity": { "principalId": has Value, "tenantId": has Value, "type": "SystemAssigned", "userAssignedIdentities": null }, "kind": has Value, "location": has Value, "managedBy": null, "name": has Value, "plan": null, "properties": null, "provisioningState": has Value, "resourceGroup": has Value, "sku": { "capacity": null, "family": null, "model": null, "name": "has Value", "size": null, "tier": "has Value" }, "tags": {has Value }, "type": "has Value" },
Get-azResource |select * PS output: ResourceId :Has Value Id : Has Value Identity : <<<<<<<<< No Value Pulled, other values from we can see in Json. Kind : <<<<<<<<< No Value Pulled Location : Has Value ManagedBy : ResourceName : Has Value Name : Has Value ExtensionResourceName : ParentResource : Plan : Properties : ResourceGroupName : Has Value Type : Has Value ResourceType : Has Value ExtensionResourceType : Sku : <<<<<<<<< No Value Pulled, other values from we can see in Json. Tags : {Has Value...} TagsTable : Has Value
SubscriptionId : Has Value CreatedTime : <<<<<<<<< No Value Pulled ChangedTime : <<<<<<<<< No Value Pulled ETag : Missing "provisioningState": <<<<<<<<< No Value Pulled,
Issue script & Debug output
$DebugPreference='Continue'
Get-azResource | select *
DEBUG: 7:59:01 AM - GetAzureResourceCmdlet begin processing with ParameterSet 'ByTagNameValueParameterSet'.
DEBUG: 7:59:01 AM - using account id 'xxxxx'...
DEBUG: 7:59:01 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: 'xxx', environment: 'AzureCloud', tenant: 'cf0exxx'
DEBUG: 7:59:01 AM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'cf0eexxx', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'
xxxxxxxx'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - 2425372xyz] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - 2425372xyz] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - 2425372xyz] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - 2425372xyz] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - 2425372xyz] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24] Found 1 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24] Returning 1 accounts
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - db879xyz] MSAL MSAL.Desktop with assembly version '4.39.0.0'. CorrelationId(db879xyz)
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - db879xyz] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - db879xyz] LoginHint provided: False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - db879xyz] Account provided: True
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - db879xyz] ForceRefresh: False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - db879xyz]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - db879xyz
UserAssertion set: False
LongRunningOboCacheKey set: False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.24 - db879xyz] === Token Acquisition (SilentRequest) started:
Scopes: https://management.core.windows.net//.default
Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.28 - db879xyz] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.28 - db879xyz] Access token is not expired. Returning the found cache entry. [Current time (08/23/2022 13:59:01) - Expiration Time (08/23/2
022 15:17:41 +00:00) - Extended Expiration Time (08/23/2022 15:17:41 +00:00)]
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.28 - db879xyz] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.28 - db879xyz] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.28 - db879xyz] Fetched access token from host login.microsoftonline.com.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.28 - db879xyz]
=== Token Acquisition finished successfully:
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [08-23 13:59:01.28 - db879xyz] AT expiration time: 2022-08-23 3:17:41 PM +00:00, scopes https://management.core.windows.net//user_impersonation https://ma
nagement.core.windows.net//.default source Cache from login.microsoftonline.com appHashCode 41907072
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: ExpiresOn: 2022-08-23T15:17:41.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'cf0eexxxxx', UserId: 'xxxx'
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/1c03c068-e0d3-4d41-92de-5bbc1f8b5870/resources?api-version=2021-04-01
Headers:
x-ms-client-request-id : 119584f5-mnb
accept-language : en-US
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Pragma : no-cache
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-request-id : 4e2642b1-mnb
x-ms-correlation-request-id : 4e2642b1-mnb
x-ms-routing-request-id : WESTUSA2:20220823T135901Z:4e2642b1-mnb
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Cache-Control : no-cache
Date : Tue, 23 Aug 2022 13:59:01 GMT
Body:
{
"value": [
{
"id": "Has Value,
"name": Has Value,
"type": "Microsoft.Compute/restorePointCollections",
"location": Has Value,
"tags": {
"Has Value"
}
.....
ResourceId :Has Value
Id : Has Value
Identity : <<<<<<<<< No Value Pulled, other values from we can see in Json.
Kind : <<<<<<<<< No Value Pulled
Location : Has Value
ManagedBy :
ResourceName : Has Value
Name : Has Value
ExtensionResourceName :
ParentResource :
Plan :
Properties :
ResourceGroupName : Has Value
Type : Has Value
ResourceType : Has Value
ExtensionResourceType :
Sku : <<<<<<<<< No Value Pulled, other values from we can see in Json.
Tags : {Has Value...}
TagsTable :
Has Value
SubscriptionId : Has Value
CreatedTime : <<<<<<<<< No Value Pulled
ChangedTime : <<<<<<<<< No Value Pulled
ETag :
Missing "provisioningState": <<<<<<<<< No Value Pulled,
DEBUG: 7:59:06 AM - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: AzureQoSEvent: Module: Az.Resources:6.1.0; CommandName: Get-AzResource; PSVersion: 5.1.19041.1682; IsSuccess: True; Duration: 00:00:05.6705188
DEBUG: Finish sending metric.
DEBUG: 7:59:07 AM - GetAzureResourceCmdlet end processing.
Environment data
Name Value
---- -----
PSVersion 7.2.6
PSEdition Core
GitCommitId 7.2.6
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Module versions
ModuleType Version PreRelease Name
---------- ------- ---------- ----
Script 2.9.1 Az.Accounts
Script 6.1.0 Az.Resources
Error output
No Errors just data missing when you run the commands, Very hard to take the az cli command script and convert to PowerShell to use in a function app to automate the extraction process.
I was able to get some of the other values, not sure why they show empty.
$Resource = (Get-AzResource) $Results=$Resource|Select ChangeTime,CreateTime,location,name,@{Label='skuname';Expression={$_.Sku.Name}},@{Label='SKUTier';Expression={$_.Sku.Tier}},tags,type,@{Label='principalId';Expression={$_.Identity.PrincipalId}}
I guess just "ProvisioningState" not mapped, and the the 2 date fields , I guess those are sub items found them by doing the (Get-AzResource).sku.Tier, etc... So maybe the other fix that is in stream will fix the dates but not sure about the missing one "ProvisioningState"
@lostsole , thanks for reporting. Resource is an abstract definition. ARM(Azure Resource Management) API is facade for all services running behind it. One reason of property missing is due to service doesn't expose those property to ARM. It's hard to resolve all resource type totally. The fix should go to each service per resource type. Could you let us know which resource type and property you need ARM team to look into?
Thank you for your feedback. This has been routed to the support team for assistance.
There are 3 that we use in our CLI scripts that we get from resources the , ChangedTime,CreatedTime and ProvisioningState, But I did see Get-AzResource does not deliver CreatedTime #18206 item, so the 2 dates may already be fixed.
@lostsole Apologies for the late reply. Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update.
@lostsole I completely agree with @dingmeng-xue's above comments.
I am pasting the same comment again just in case you missed it:
Resource is an abstract definition. ARM(Azure Resource Management) API is facade for all services running behind it. One reason of property missing is due to service doesn't expose those property to ARM. It's hard to resolve all resource type totally. The fix should go to each service per resource type. Could you let us know which resource type and property you need ARM team to look into?
Also to add on to the above comment, each service exposes different properties back to ARM and its not same. Example: Get VM API returns provisioning state, sku, timeCreated etc While the Get SQL Server REST API doesn't.
So please let us know which resource are you specifically concerned about.
@lostsole I wanted to do quick follow-up to check if you had a chance to look at my above comment. Please let us know the resource type you are concerned about. That will help us to look at that particular resource and involve service team if required. Awaiting your reply.
@lostsole We are still waiting for the update from you on the resource type you are concerned about. Please feel free to reopen this thread, once you are ready to work on this. We would be happy to help.
Get-AzResource and az resource should return the same results. I am not a Code Developer, but when I do I try to make sure that if I have 5 outputs I would insure I have 5 outputs(az resource) from the new code (Get-AzResource) or Program.
Maybe I don't understand. Like I said before, I use ChangedTime,CreatedTime and ProvisioningState, and it looks like you have a #18206 which should fix the 2 Dates that are missing. so that would only leave the ProvisioningState missing.
Sorry I was a way for a bit, so I couldn't log into my account
@lostsole As mentioned earlier, each service exposes different properties back to ARM and its not same.
Example: Get VM API returns provisioning state, sku, timeCreated etc While the Get SQL Server REST API doesn't.
So please let us know which resource are you specifically concerned about.
So when we run The CLI command ( az resource list ) it has Provisioning State for the Resource, this Provisioning state shows up under this command, So all resources have a this Provisioning State from the > az resource list CLI command,
I don't know where this gets if from. So I can not tell you where to focus, maybe this is not an important field and is not need in the Powershell command.
Quick question is there an ETA when the CreatedTime and change time will be updated in the Get-AzResource that was reported in https://github.com/Azure/azure-powershell/issues/18206?