Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.27k stars 3.87k forks source link

Get-AzIntegrationAccountMap returns only maps in XSLT format #7759

Open ajhall opened 6 years ago

ajhall commented 6 years ago

Description

Get-AzIntegrationAccountMap only supports XSLT format and does not provide a way to work with other formats. Maps in Liquid format, for example, can be added via the portal or the REST API but are inaccessible via Azure PowerShell.

When listing maps, the list is filtered on the following line to show only XSLT:

https://github.com/Azure/azure-powershell/blob/b61106c491fc624776f3be3f933879c8cf7ffb36/src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/IntegrationAccountMapOperations.cs#L105

The -MapName parameter can be used to retrieve a specific map, but retrieving a Liquid format map results in an "Unable to deserialize the response" error.

I would understand the limitation if the content of the map was included in the response and needed to be deserialized into a PowerShell object, but the response actually just includes a contentLink object with a URI inside to get the map content. The only significant difference in the API response compared to an XSLT map is the mapType property.

Script/Steps for Reproduction

First, create an integration account in the Azure Portal and add a map in Liquid format. (This is unsupported in Azure PowerShell). Optionally, add another map in XSLT format to illustrate that the list of maps is filtered to XSLT.

Run Get-AzIntegrationAccountMap without specifying -MapName. Only XSLT maps are returned.

Get-AzIntegrationAccountMap `
 -ResourceGroupName MyIA-rg `
 -Name MyIA

Run Get-AzIntegrationAccountMap with a -MapName specified to specifically request the Liquid map. The cmdlet will return "Unable to deserialize the response."

Get-AzIntegrationAccountMap `
 -ResourceGroupName MyIA-rg `
 -Name MyIA `
 -MapName MyLiquidMap

Module Version

Get-Module -ListAvailable

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     0.4.0      Az.Aks                              Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential...}
Script     0.4.0      Az.AnalysisServices                 Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServicesServer, Remove-AzAnalysisServicesServer...}
Script     0.4.0      Az.ApiManagement                    Core,Desk {Add-AzApiManagementRegion, Get-AzApiManagementSsoToken, New-AzApiManagementHostnameConfiguration, New-AzApiManagementCustomHostnameConfiguration...}
Script     0.4.0      Az.ApplicationInsights              Core,Desk {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationInsights, Set-AzApplicationInsightsPricingPlan...}
Script     0.4.0      Az.Automation                       Core,Desk {Get-AzAutomationHybridWorkerGroup, Get-AzAutomationJobOutputRecord, Import-AzAutomationDscNodeConfiguration, Export-AzAutomationDscConfiguration...}
Script     0.4.0      Az.Batch                            Core,Desk {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKeys, New-AzBatchAccount...}
Script     0.4.0      Az.Billing                          Core,Desk {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccount}
Script     0.4.0      Az.Cdn                              Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnProfile...}
Script     0.4.0      Az.CognitiveServices                Core,Desk {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKey, Get-AzCognitiveServicesAccountSkus, Get-AzCognitiveServicesAccountUsage...}
Script     0.4.0      Az.Compute                          Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvailabilitySet...}
Script     0.4.0      Az.Consumption                      Core,Desk {Get-AzConsumptionBudget, Get-AzConsumptionMarketplace, Get-AzConsumptionPriceSheet, Get-AzConsumptionReservationDetail...}
Script     0.4.0      Az.ContainerInstance                Core,Desk {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-AzContainerInstanceLog}
Script     0.4.0      Az.ContainerRegistry                Core,Desk {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-AzContainerRegistry...}
Script     0.4.0      Az.DataLakeAnalytics                Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential, Remove-AzDataLakeAnalyticsCatalogCredential, Remove-AzDataLakeAnalyticsCatalogSecret...}
Script     0.4.0      Az.DataLakeStore                    Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreFirewallRule, Set-AzDataLakeStoreTrustedIdProvider...}
Script     0.4.0      Az.DevTestLabs                      Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy, Get-AzDtlVMsPerLabPolicy...}
Script     0.4.0      Az.Dns                              Core,Desk {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet, Set-AzDnsRecordSet...}
Script     0.4.0      Az.EventGrid                        Core,Desk {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic, New-AzEventGridTopicKey...}
Script     0.4.0      Az.EventHub                         Core,Desk {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubNamespace, Remove-AzEventHubNamespace...}
Script     0.4.0      Az.Insights                         Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile...}
Script     0.4.0      Az.IotHub                           Core,Desk {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubConnectionString, Get-AzIotHubJob...}
Script     0.4.0      Az.KeyVault                         Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperation, Get-AzKeyVaultCertificateOperation...}
Script     0.4.0      Az.LogicApp                         Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountCallbackUrl, Get-AzIntegrationAccountCertificate, Get-AzIntegrationAccount...}
Script     0.4.0      Az.MachineLearning                  Core,Desk {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, Get-AzMlCommitmentPlanUsageHistory, Remove-AzMlCommitmentPlan...}
Script     0.4.0      Az.MachineLearningCompute           Core,Desk {Get-AzMlOpCluster, Get-AzMlOpClusterKey, Test-AzMlOpClusterSystemServicesUpdateAvailability, Update-AzMlOpClusterSystemService...}
Script     0.4.0      Az.MarketplaceOrdering              Core,Desk {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script     0.4.0      Az.Media                            Core,Desk {Sync-AzMediaServiceStorageKeys, Set-AzMediaServiceKey, Get-AzMediaServiceKeys, Get-AzMediaServiceNameAvailability...}
Script     0.4.0      Az.Network                          Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGatewayAuthenticationCertificate, New-AzApplicationGatewayAuthenticationCertificate, Remove-AzApplicationGateway... Script     0.4.0      Az.NotificationHubs                 Core,Desk {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRules, Get-AzNotificationHubListKeys, Get-AzNotificationHubPNSCredentials...}
Script     0.4.0      Az.OperationalInsights              Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsightsCustomLogDataSource, Disable-AzOperationalInsightsLinuxCustomLogCollection, Disable-AzOperationalInsig... Script     0.4.0      Az.PolicyInsights                   Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary}
Script     0.4.0      Az.PowerBIEmbedded                  Core,Desk {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollectionAccessKeys, Get-AzPowerBIWorkspace...}
Script     0.4.0      Az.Profile                          Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave...}
Script     0.4.0      Az.RecoveryServices                 Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVault, Get-AzRecoveryServicesVaultSettingsFile, New-AzRecoveryServicesVault...}
Script     0.4.0      Az.RedisCache                       Core,Desk {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedisCachePatchSchedule, New-AzRedisCachePatchSchedule...}
Script     0.4.0      Az.Relay                            Core,Desk {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace, Remove-AzRelayNamespace...}
Script     0.4.0      Az.Resources                        Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignment...}
Script     0.4.0      Az.ServiceBus                       Core,Desk {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNamespace, Remove-AzServiceBusNamespace...}
Script     0.4.0      Az.ServiceFabric                    Core,Desk {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricClientCertificate, Add-AzServiceFabricClusterCertificate, Add-AzServiceFabricNode...}
Script     0.4.0      Az.SignalR                          Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey...}
Script     0.4.0      Az.Sql                              Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDataEncryptionActivity, Set-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseUpgradeHint...}
Script     0.4.0      Az.Storage                          Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKey...}
Script     0.4.0      Az.StreamAnalytics                  Core,Desk {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefinition, New-AzStreamAnalyticsFunction, Remove-AzStreamAnalyticsFunction...}
Script     0.4.0      Az.Tags                             Core,Desk {Remove-AzTag, Get-AzTag, New-AzTag}
Script     0.4.0      Az.TrafficManager                   Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHeaderFromEndpoint, Add-AzTrafficManagerCustomHeaderToProfile, Remove-AzTrafficManagerCustomHeaderFromProfi... Script     0.4.0      Az.UsageAggregates                  Core,Desk Get-UsageAggregates
Script     0.4.0      Az.Websites                         Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-AzAppServicePlan...}
Script     5.3.0      Azure                               Desk      {Get-AzureAutomationCertificate, Get-AzureAutomationConnection, New-AzureAutomationConnection, Remove-AzureAutomationConnection...}
Script     2.0.230    oh-my-posh                          Desk      {Show-Colors, Show-ThemeColors, Show-ThemeSymbols, Get-Theme...}
Manifest   0.7.1      posh-docker                         Desk      ConvertFrom-Docker
Binary     0.7.0      PSKubectl                           Desk      {Compare-KubeResource, ConvertFrom-KubeYaml, Get-KubeConfig, Get-KubeDeployment...}
Binary     0.8.1      SHiPS                               Desk
Script     0.0.2      Trackyon.Utils                      Desk      {Backup-Location, Get-OperatingSystem, New-Directory, Set-As...}
Manifest   4.0.12     VSTeam                              Desk      {Add-VSTeamAzureRMServiceEndpoint, Add-VSTeamSonarQubeEndpoint, Add-VSTeamKubernetesEndpoint, Add-VSTeamServiceFabricEndpoint...}

    Directory: C:\Program Files\PowerShell\Modules

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     0.7.1      posh-git                            Desk      {Invoke-NullCoalescing, Add-PoshGitToProfile, Write-GitStatus, Write-Prompt...}

    Directory: C:\program files\powershell\6\Modules

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Manifest   6.1.0.0    CimCmdlets                          Core      {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSession...}
Manifest   1.1.0.0    Microsoft.PowerShell.Archive        Desk      {Compress-Archive, Expand-Archive}
Manifest   6.1.0.0    Microsoft.PowerShell.Diagnostics    Core      {Get-WinEvent, New-WinEvent}
Manifest   6.1.0.0    Microsoft.PowerShell.Host           Core      {Start-Transcript, Stop-Transcript}
Manifest   6.1.0.0    Microsoft.PowerShell.Management     Core      {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}
Manifest   6.1.0.0    Microsoft.PowerShell.Security       Core      {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}
Manifest   6.1.0.0    Microsoft.PowerShell.Utility        Core      {Format-List, Format-Custom, Format-Table, Format-Wide...}
Manifest   6.1.0.0    Microsoft.WSMan.Management          Core      {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSSP, Set-WSManQuickConfig...}
Script     1.1.7.2    PackageManagement                   Desk      {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script     1.6.7      PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Script     0.0        PSDesiredStateConfiguration         Desk      {Get-PublicKeyFromFile, GetModule, ImportClassResourcesFromModule, Test-NodeResourceSource...}
Script     6.1.0.0    PSDiagnostics                       Core      {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, Enable-PSTrace...}
Script     2.0.0      PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption...}
Binary     1.1.2      ThreadJob                           Desk      Start-ThreadJob

Environment Data

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Microsoft Windows 10.0.17134
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Debug Output

Get-AzIntegrationAccountMap `
>> -ResourceGroupName EDI-AzureDevOps-Demo `
>> -Name Demo-IA `
>> -MapName MyLiquidMap
DEBUG: 4:13:10 PM - GetAzureIntegrationAccountMapCommand begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 4:13:10 PM - using account id 'redacted@redacted.com'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'redacted@redacted.com', environment: 'AzureCloud', tenant: 'redacted'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/redacted/resourceGroups/EDI-AzureDevOps-Demo/providers/Microsoft.Logic/integrationAccounts/Demo-IA/maps/MyLiquidMap?api-version=2016-06-01

Headers:
x-ms-client-request-id        : 23b726bb-8e66-4d76-a4cc-a4edadf297c8
Accept-Language               : en-US

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Vary                          : Accept-Encoding
x-ms-request-id               : northcentralus:f65f9ab8-7a5b-4b8a-8072-f00e62d0e917
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-reads: 11994
x-ms-correlation-request-id   : 31149dae-f0af-4118-86e4-9b215079fb41
x-ms-routing-request-id       : SOUTHCENTRALUS:20181106T211311Z:31149dae-f0af-4118-86e4-9b215079fb41
X-Content-Type-Options        : nosniff
Date                          : Tue, 06 Nov 2018 21:13:11 GMT

Body:
{
  "properties": {
    "mapType": "Liquid",
    "contentLink": {
      "uri": "https://prod-18.northcentralus.logic.azure.com:443/integrationAccounts/redacted/maps/MyLiquidMap/contents/Value?api-version=2015-08-01-preview&se=2018-11-07T01%3A13%3A11.2753305Z&sp=%2Fmaps%2FMyLiquidMap%2Fread&sv=1.0&sig=jRSsBj_01o3HO9zzsIDfpyko_4gb1K-8z3IHAMfmmQA",
      "contentVersion": "\"0x8D6442C77095807\"",
      "contentSize": 1839,
      "contentHash": {
        "algorithm": "md5",
        "value": "4k2spvkqQ1ln+3Z+tYEwdQ=="
      }
    },
    "createdTime": "2018-11-06T21:11:48.5814543Z",
    "changedTime": "2018-11-06T21:11:48.5822246Z",
    "metadata": {
      "fileName": null
    }
  },
  "id": "/subscriptions/redacted/resourceGroups/EDI-AzureDevOps-Demo/providers/Microsoft.Logic/integrationAccounts/Demo-IA/maps/MyLiquidMap",
  "name": "MyLiquidMap",
  "type": "Microsoft.Logic/integrationAccounts/maps"
}

Get-AzIntegrationAccountMap : Unable to deserialize the response.
At line:1 char:1
+ Get-AzIntegrationAccountMap `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [Get-AzIntegrationAccountMap], SerializationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.LogicApp.Cmdlets.GetAzureIntegrationAccountMapCommand

DEBUG: AzureQoSEvent: CommandName - Get-AzIntegrationAccountMap; IsSuccess - False; Duration - 00:00:00.6632264; Exception - Microsoft.Rest.SerializationException: Unable to deserialize the response. ---> Newtonsoft.Json.JsonSerializationException: Error converting value "Liquid" to type 'Microsoft.Azure.Management.Logic.Models.MapType'. Path 'properties.mapType', line 1, position 33. ---> System.ArgumentException: Requested value 'Liquid' was not found.
   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnum(Type enumType, String value, Boolean disallowNumber)
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.Serialization.JsonSerializerProxy.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at Microsoft.Rest.Serialization.TransformationJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
   at Microsoft.Azure.Management.Logic.MapsOperations.GetWithHttpMessagesAsync(String resourceGroupName, String integrationAccountName, String mapName, Dictionary`2 customHeaders, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.Azure.Management.Logic.MapsOperations.GetWithHttpMessagesAsync(String resourceGroupName, String integrationAccountName, String mapName, Dictionary`2 customHeaders, CancellationToken cancellationToken)
   at Microsoft.Azure.Management.Logic.MapsOperationsExtensions.GetAsync(IMapsOperations operations, String resourceGroupName, String integrationAccountName, String mapName, CancellationToken cancellationToken)
   at Microsoft.Azure.Management.Logic.MapsOperationsExtensions.Get(IMapsOperations operations, String resourceGroupName, String integrationAccountName, String mapName)
   at Microsoft.Azure.Commands.LogicApp.Cmdlets.GetAzureIntegrationAccountMapCommand.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 4:13:12 PM - GetAzureIntegrationAccountMapCommand end processing.
DEBUG: 4:13:12 PM - GetAzureIntegrationAccountMapCommand end processing.
maddieclayton commented 6 years ago

@pankajsn @daviburg Can you take a look at this issue?