Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-AzApiManagementBackend 4.0.5 fails with "'url' should not be empty" #26837

Open
ptorba opened this issue Dec 4, 2024 · 2 comments · Fixed by #26714
Open

New-AzApiManagementBackend 4.0.5 fails with "'url' should not be empty" #26837

ptorba opened this issue Dec 4, 2024 · 2 comments · Fixed by #26714
Assignees
Labels
API Management bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported

Comments

@ptorba
Copy link

ptorba commented Dec 4, 2024

Description

When using Az.ApiManagement 4.0.5, New-AzApiManagementBackend command fails even when parameters are provided.

New-AzApiManagementBackend `
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     |  Error Code: ValidationError Error Message: One or more fields contain
     | incorrect values: Request Id: 2dd68334-2530-4284-b326-48e03b5789b7 Error
     | Details:  [Code= ValidationError, Message= 'url' should not be empty.,
     | Target= url]  [Code= ValidationError, Message= 'protocol' should not be
     | empty., Target= protocol]

Issue script & Debug output

Script:

$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName $ApimResourceGroup -ServiceName $ApiMgmtName
$BackendCredential = New-AzApiManagementBackendCredential -Header @{"x-functions-key" = @("{{valval}}") }
New-AzApiManagementBackend `
        -Context $ApiMgmtContext `
        -BackendId $BackendName `
        -Protocol http `
        -Url "https://my-domain.com/api" `
        -Credential $BackendCredential

Logs:

DEBUG: Initializing ConditionalAssemblyContext. PSEdition is [Core]. PSVersion is [7.4.6].
DEBUG: Initializing ConditionalAssemblyProvider. AssemblyRootPath is [/home/tpawel/.local/share/powershell/Modules/Az.Accounts/4.0.0/StartupScripts/../lib].
DEBUG: Registering Az shared AssemblyLoadContext.
DEBUG: AssemblyLoadContext registered.
DEBUG: Initializing PSStyle.
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - NewAzureApiManagementContext begin processing with ParameterSet 'ContextParameterSet'.
DEBUG: 5:07:11 PM - using account id '[REDACTED]'...
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.ApiManagement:4.0.5; CommandName: New-AzApiManagementContext; PSVersion: 7.4.6; IsSuccess: True; Duration: 00:00:00.0195837; SanitizeDuration: 00:00:00.0006008
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - NewAzureApiManagementContext end processing.
Importing api...
Creating backend
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - NewAzureApiManagementBackendCredential begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 5:07:11 PM - using account id '[REDACTED]'...
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.ApiManagement:4.0.5; CommandName: New-AzApiManagementBackendCredential; PSVersion: 7.4.6; IsSuccess: True; Duration: 00:00:00.0011815; SanitizeDuration: 00:00:00.0002764
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - NewAzureApiManagementBackendCredential end processing.
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:11 PM - NewAzureApiManagementBackend begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 5:07:11 PM - using account id '[REDACTED]'...
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: '[REDACTED]', environment: 'AzureCloud', tenant: '[REDACTED]'
DEBUG: 5:07:11 PM - [ConfigManager] Got nothing from [DisableInstanceDiscovery], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 5:07:11 PM - [ConfigManager] Got [False] from [EnableLoginByWam], Module = [], Cmdlet = [].
DEBUG: 5:07:11 PM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'[REDACTED]', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'[REDACTED]'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: 
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 11f635c7-a96d-423c-95db-8cbcdf3db2e5] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 11f635c7-a96d-423c-95db-8cbcdf3db2e5] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 11f635c7-a96d-423c-95db-8cbcdf3db2e5] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 11f635c7-a96d-423c-95db-8cbcdf3db2e5] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 11f635c7-a96d-423c-95db-8cbcdf3db2e5] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z] Found 1 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z] Returning 1 accounts
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] MSAL MSAL.CoreCLR with assembly version '4.65.0.0'. CorrelationId(1005b4fe-f3c3-4f6d-ba13-af98c17946cb)
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] LoginHint provided: False
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] Account provided: True
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] ForceRefresh: False
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] 
=== 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 - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured: 

DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] === Token Acquisition (SilentRequest) started:
         Scopes: https://management.core.windows.net//.default
        Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] Access token is not expired. Returning the found cache entry. [Current time (12/04/2024 17:07:12) - Expiration Time (12/04/2024 18:25:45 +00:00) - Extended Expiration Time (12/04/2024 18:25:45 +00:00)]
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb] 
        === Token Acquisition finished successfully:
DEBUG: False MSAL 4.65.0.0 MSAL.CoreCLR .NET 8.0.10 Linux [2024-12-04 17:07:12Z - 1005b4fe-f3c3-4f6d-ba13-af98c17946cb]  AT expiration time: 12/4/2024 6:25:45 PM +00:00, scopes: https://management.core.windows.net//.default https://management.core.windows.net//user_impersonation. source: Cache
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:  ExpiresOn: 2024-12-04T18:25:45.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: [REDACTED], UserId: '[REDACTED]'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri: [REDACTED]

Headers:
Accept-Language               : en-US
x-ms-client-request-id        : 9a2e8cfe-e4da-445f-a081-2a9d8c5bc4a2

Body:
{
  "properties": {
    "credentials": {
      "header": {
        "x-functions-key": [
          "{{valval}}"
        ]
      }
    }
  }
}


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

Status Code:
BadRequest

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
x-ms-request-id               : ee31d0aa-d430-4fdc-a4ea-9955a1a71be7
x-ms-ratelimit-remaining-subscription-writes: 199
x-ms-ratelimit-remaining-subscription-global-writes: 2999
x-ms-correlation-request-id   : ee31d0aa-d430-4fdc-a4ea-9955a1a71be7
x-ms-routing-request-id       : NORTHEUROPE:20241204T170712Z:ee31d0aa-d430-4fdc-a4ea-9955a1a71be7
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : Ref A: 6255015791FA43A7B8DF15942AB31301 Ref B: AMS231032609033 Ref C: 2024-12-04T17:07:12Z
Date                          : Wed, 04 Dec 2024 17:07:11 GMT

Body:
{
  "error": {
    "code": "ValidationError",
    "message": "One or more fields contain incorrect values:",
    "details": [
      {
        "code": "ValidationError",
        "target": "url",
        "message": "'url' should not be empty."
      },
      {
        "code": "ValidationError",
        "target": "protocol",
        "message": "'protocol' should not be empty."
      }
    ]
  }
}


DEBUG: 5:07:12 PM - [ConfigManager] Got nothing from [EnableErrorRecordsPersistence], Module = [], Cmdlet = []. Returning default value [False].
New-AzApiManagementBackend: deploy.ps1:104:5
Line |
 104 |      New-AzApiManagementBackend `
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     |  Error Code: ValidationError Error Message: One or more
     | fields contain incorrect values: Request Id:
     | ee31d0aa-d430-4fdc-a4ea-9955a1a71be7 Error Details:  [Code=
     | ValidationError, Message= 'url' should not be empty.,
     | Target= url]  [Code= ValidationError, Message= 'protocol'
     | should not be empty., Target= protocol]
DEBUG: 5:07:12 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:12 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:12 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.ApiManagement:4.0.5; CommandName: New-AzApiManagementBackend; PSVersion: 7.4.6; IsSuccess: False; Duration: 00:00:01.2171898; SanitizeDuration: 00:00:00; Exception: 
Error Code: ValidationError
Error Message: One or more fields contain incorrect values:
Request Id: ee31d0aa-d430-4fdc-a4ea-9955a1a71be7
Error Details:
        [Code= ValidationError, Message= 'url' should not be empty., Target= url]
        [Code= ValidationError, Message= 'protocol' should not be empty., Target= protocol]
;
DEBUG: 5:07:12 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 5:07:12 PM - NewAzureApiManagementBackend end processing.

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.6
PSEdition                      Core
GitCommitId                    7.4.6
OS                             Ubuntu 24.04.1 LTS
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

Version              Name                                Repository
-------              ----                                ----------
4.1.1                Az.Functions                        PSGallery 
4.0.5                Az.ApiManagement                    PSGallery 
4.0.0                Az.Accounts                         PSGallery

Error output

@ptorba ptorba added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Dec 4, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Dec 4, 2024
@VeryEarly VeryEarly added API Management and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Dec 5, 2024
@JoyerJin
Copy link
Contributor

JoyerJin commented Dec 5, 2024

It also has been fixed by #26714. Please waiting the next release. Thanks.

@JoyerJin JoyerJin linked a pull request Dec 5, 2024 that will close this issue
6 tasks
@ptorba
Copy link
Author

ptorba commented Dec 5, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Management bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants