When you enter Get-AzVMImage for an image that doesn't exist, it returns with error "Get-AzVMImage : Object reference not set to an instance of an object."
PS C:\Users\Administrator> Get-AzVMImage -Location local -PublisherName Microsoft -Offer WindowsServer -Skus 2016-Datacenter -debug -verbose
DEBUG: 4:26:59 PM - GetAzureVMImageCommand begin processing with ParameterSet 'ListVMImage'.
DEBUG: 4:27:01 PM - using account id '[email protected]'...
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzStackAdmin', tenant: '986b5c90-83d4-4fd7-96e7-5e115ad6372c'
DEBUG: [SilentAuthenticator] Creating IPublicClientApplication - ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', Authority: 'https://adfs.local.azurestack.external/adfs/', UseAdf
s: 'True'
DEBUG: [SilentAuthenticator] Calling GetAccountsAsync
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 662aacba-ecac-4685-876f-cbbbd662454b] (UnknownClient: 0.0.0.0) [Instance Discovery] Skipping Insta
nce discovery for non-AAD authority
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 662aacba-ecac-4685-876f-cbbbd662454b] (UnknownClient: 0.0.0.0) [Instance Discovery] Skipping Insta
nce discovery for non-AAD authority
DEBUG: [SilentAuthenticator] Calling AcquireTokenSilent - Scopes: 'https://adminmanagement.adfs.azurestack.local/986b5c90-83d4-4fd7-96e7-5e115ad6372c/openid', UserId: 'CloudAdmin@a
zurestack.local', Number of accounts: '1'
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) MSAL MSAL.CoreCLR with assembly ver
sion '4.10.0.0'. CorrelationId(4fa93919-896e-47f4-81a7-5c3e648505ce)
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) === OnBehalfOfParameters ===
LoginHint provided: False
User provided: True
ForceRefresh: False
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0)
=== Request Data ===
Authority Provided? - True
Scopes - https://adminmanagement.adfs.azurestack.local/986b5c90-83d4-4fd7-96e7-5e115ad6372c/openid
Extra Query Params Keys (space separated) -
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) === Token Acquisition (SilentReques
t) started:
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) Looking up access token in the cach
e.
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) Filtering by tenant id item count b
efore 1 after 1
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) Filtering by home account id item c
ount before 1 after 1
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) Filtering by token type item count
before 1 after 1
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) Matching entry count - 1
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) Filtering by scopes item count befo
re 1 after 1
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) [Instance Discovery] Skipping Insta
nce discovery for non-AAD authority
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) [Instance Discovery] Skipping Insta
nce discovery for non-AAD authority
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) Access token is not expired. Return
ing the found cache entry. [Current time (09/17/2020 23:27:01) - Expiration Time (09/18/2020 00:08:20 +00:00) - Extended Expiration Time (01/01/0001 00:00:00 +00:00)]
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) Returning access token found in cac
he. RefreshOn exists ? False
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 4fa93919-896e-47f4-81a7-5c3e648505ce] (UnknownClient: 0.0.0.0) === Token Acquisition finished succ
essfully. An access token was returned with Expiration Time: 09/18/2020 00:08:20 +00:00 ===
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '986b5c90-83d4-4fd7-96e7-5e115ad6372c', UserId: ''
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzStackAdmin', tenant: '986b5c90-83d4-4fd7-96e7-5e115ad6372c'
DEBUG: [SilentAuthenticator] Creating IPublicClientApplication - ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', Authority: 'https://adfs.local.azurestack.external/adfs/', UseAdf
s: 'True'
DEBUG: [SilentAuthenticator] Calling GetAccountsAsync
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 5f7f1c0a-ab04-417e-9e9c-7af0caf429ba] (UnknownClient: 0.0.0.0) [Instance Discovery] Skipping Insta
nce discovery for non-AAD authority
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - 5f7f1c0a-ab04-417e-9e9c-7af0caf429ba] (UnknownClient: 0.0.0.0) [Instance Discovery] Skipping Insta
nce discovery for non-AAD authority
DEBUG: [SilentAuthenticator] Calling AcquireTokenSilent - Scopes: 'https://adminmanagement.adfs.azurestack.local/986b5c90-83d4-4fd7-96e7-5e115ad6372c/openid', UserId: 'CloudAdmin@a
zurestack.local', Number of accounts: '1'
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) MSAL MSAL.CoreCLR with assembly ver
sion '4.10.0.0'. CorrelationId(f402b1b6-84e1-41ff-bec9-b22fd04a8ac6)
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) === OnBehalfOfParameters ===
LoginHint provided: False
User provided: True
ForceRefresh: False
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0)
=== Request Data ===
Authority Provided? - True
Scopes - https://adminmanagement.adfs.azurestack.local/986b5c90-83d4-4fd7-96e7-5e115ad6372c/openid
Extra Query Params Keys (space separated) -
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) === Token Acquisition (SilentReques
t) started:
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) Looking up access token in the cach
e.
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) Filtering by tenant id item count b
efore 1 after 1
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) Filtering by home account id item c
ount before 1 after 1
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) Filtering by token type item count
before 1 after 1
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) Matching entry count - 1
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) Filtering by scopes item count befo
re 1 after 1
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) [Instance Discovery] Skipping Insta
nce discovery for non-AAD authority
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) [Instance Discovery] Skipping Insta
nce discovery for non-AAD authority
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) Access token is not expired. Return
ing the found cache entry. [Current time (09/17/2020 23:27:01) - Expiration Time (09/18/2020 00:08:20 +00:00) - Extended Expiration Time (01/01/0001 00:00:00 +00:00)]
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) Returning access token found in cac
he. RefreshOn exists ? False
DEBUG: [MSAL] Info: (False) MSAL 4.10.0.0 MSAL.CoreCLR N/A [09/17/2020 23:27:01 - f402b1b6-84e1-41ff-bec9-b22fd04a8ac6] (UnknownClient: 0.0.0.0) === Token Acquisition finished succ
essfully. An access token was returned with Expiration Time: 09/18/2020 00:08:20 +00:00 ===
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '986b5c90-83d4-4fd7-96e7-5e115ad6372c', UserId: ''
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://adminmanagement.local.azurestack.external/subscriptions/8991992d-03f0-4258-9bf8-fcc4a8c3365f/providers/Microsoft.Compute/locations/local/publishers/Microsoft/artifacttypes/
vmimage/offers/WindowsServer/skus/2016-Datacenter/versions?api-version=2017-12-01
Headers:
x-ms-client-request-id : aeb29629-b3f5-489a-8167-8c8d9fa96ef2
accept-language : en-US
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
NotFound
Headers:
Pragma : no-cache
x-ms-correlation-request-id : fcb1de4c-d8d2-4b5a-8a96-e35d7fd07389
x-ms-ratelimit-remaining-subscription-reads: 14906
x-ms-request-id : fcb1de4c-d8d2-4b5a-8a96-e35d7fd07389
x-ms-routing-request-id : LOCAL:20200917T232701Z:fcb1de4c-d8d2-4b5a-8a96-e35d7fd07389
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Cache-Control : no-cache
Date : Thu, 17 Sep 2020 23:27:01 GMT
Server : Microsoft-HTTPAPI/2.0
WWW-Authenticate : oYG3MIG0oAMKAQChCwYJKoZIgvcSAQICooGfBIGcYIGZBgkqhkiG9xIBAgICAG+BiTCBhqADAgEFoQMCAQ+iejB4oAMCARKicQRvfFYwZnIPBGOOfrsYPg0pO2vq1TBll9hPVliIu9yg1mQTJKa4
ucEa/xX6XXX/b04wTbS1XXydp86kukce3tAZdf77TKbR70hQ9NkHx9XmpxYtSmEz8WaxJENsOXy8nQBKRdRtiA6b12qhU9Cz/rXU
Body:
DEBUG: 4:27:01 PM - GetAzureVMImageCommand end processing.
Get-AzVMImage : Object reference not set to an instance of an object.
At line:1 char:1
+ Get-AzVMImage -Location local -PublisherName Microsoft -Offer Windows ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzVMImage], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.GetAzureVMImageCommand
DEBUG: 4:27:02 PM - GetAzureVMImageCommand end processing.