Azure / Azure/azure-powershell

The 'parameters.properties' segment in the url is invalid when running Set-AzSqlServerActiveDirectoryAdministrator

Open
#23,509 23 comments 1 reaction 0 assignees View on GitHub
act-codegen-extensibility-squad bug customer-reported needs-team-attention Service Attention SQL
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description

When running Set-AzSqlServerActiveDirectoryAdministrator command, I am getting error `The 'parameters.properties' segment in the url is invalid` when using **Az.Sql 4.11.0**.

Running the command with exact same parameters using Az.Sql 4.10.0 is fine. No errors and works as expected.

### Issue script & Debug output

```PowerShell
Script: Set-AzSqlServerActiveDirectoryAdministrator -ResourceGroupName SQL-SERVER-RG-NAME -ServerName SQL-SERVER-NAME -DisplayName APP-NAME -ObjectId APP-ID

Output:

DEBUG: 3:48:55 PM - SetAzureSqlServerActiveDirectoryAdministrator begin processing with ParameterSet
'__AllParameterSets'.
DEBUG: 3:48:55 PM - using account id ''...
DEBUG: 3:48:55 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
Returning default value [True].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/ed36e373-13fc-42ec-93f4-38a6e84754f0/resourceGroups/
/providers/Microsoft.Sql/servers//administrators/Ac
tiveDirectory?api-version=2020-11-01-preview

Headers:
x-ms-client-request-id : 128e160e-efef-4d0a-99d7-71a3f8a62f21
accept-language : en-US

Body:

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

Status Code:
OK

Headers:
Pragma : no-cache
x-ms-request-id : 51ed09bc-d9be-45a9-b46b-cbd230381c8b
x-ms-ratelimit-remaining-subscription-reads: 11992
x-ms-correlation-request-id : bb388d91-6a40-49a8-a5ab-66b0c689f346
x-ms-routing-request-id : AUSTRALIACENTRAL2:20231121T044855Z:bb388d91-6a40-49a8-a5ab-66b0c689f346
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
X-Cache : CONFIG_NOCACHE
X-MSEdge-Ref : Ref A: FF365C273FEC4A209D8AD929C3EEEE36 Ref B: SYD03EDGE2008 Ref C:
2023-11-21T04:48:55Z
Cache-Control : no-cache
Date : Tue, 21 Nov 2023 04:48:54 GMT

Body:
{
"properties": {
"administratorType": "ActiveDirectory",
"login": "",
"sid": "",
"tenantId": "",
"azureADOnlyAuthentication": true
},
"id":
"/subscriptions/ed36e373-13fc-42ec-93f4-38a6e84754f0/resourceGroups//prov
iders/Microsoft.Sql/servers//administrators/ActiveDirectory",
"name": "ActiveDirectory",
"type": "Microsoft.Sql/servers"
}

DEBUG: [Common.Authentication]: Authenticating using Account: '', environment: 'AzureCloud',
tenant: ''
DEBUG: 3:48:55 PM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default
value [False].
DEBUG: 3:48:55 PM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync -
TenantId:'', Scopes:'https://graph.microsoft.com//.default',
AuthorityHost:'https://login.microsoftonline.com/', UserId:''
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://graph.microsoft.com//.default ] ParentRequestId:
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
079eadc0-70ea-4938-be9c-8627dcfa23fa] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
079eadc0-70ea-4938-be9c-8627dcfa23fa] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
079eadc0-70ea-4938-be9c-8627dcfa23fa] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
079eadc0-70ea-4938-be9c-8627dcfa23fa] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
079eadc0-70ea-4938-be9c-8627dcfa23fa] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z] Found 1
cache accounts and 0 broker accounts
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z] Returning 1
accounts
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] MSAL MSAL.Desktop with assembly version '4.49.1.0'.
CorrelationId(ae41c45b-6fec-4f8c-8899-0d152055f6f2)
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] LoginHint provided: False
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] Account provided: True
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] ForceRefresh: False
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2]
=== Request Data ===
Authority Provided? - True
Scopes - https://graph.microsoft.com//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - ae41c45b-6fec-4f8c-8899-0d152055f6f2
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] === Token Acquisition (SilentRequest) started:
Scopes: https://graph.microsoft.com//.default
Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] Access token is not expired. Returning the found cache entry. [Current time
(11/21/2023 04:48:55) - Expiration Time (11/21/2023 06:02:37 +00:00) - Extended Expiration Time (11/21/2023 06:02:37
+00:00)]
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2]
=== Token Acquisition finished successfully:
DEBUG: False MSAL 4.49.1.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2023-11-21 04:48:55Z -
ae41c45b-6fec-4f8c-8899-0d152055f6f2] AT expiration time: 21/11/2023 6:02:37 AM +00:00, scopes: email openid profile
https://graph.microsoft.com//AuditLog.Read.All https://graph.microsoft.com//Directory.AccessAsUser.All
https://graph.microsoft.com//.default. source: Cache
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://graph.microsoft.com//.default ]
ParentRequestId: ExpiresOn: 2023-11-21T06:02:37.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '',
UserId: ''
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://graph.microsoft.com/v1.0/groups/

Headers:
x-ms-client-request-id : 128e160e-efef-4d0a-99d7-71a3f8a62f21
accept-language : en-US

Body:


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

Status Code:
NotFound

Headers:
Transfer-Encoding : chunked
Strict-Transport-Security : max-age=31536000
request-id : 486d4b6e-4b6a-4e8f-b7f3-0b66d8c37d34
client-request-id : 486d4b6e-4b6a-4e8f-b7f3-0b66d8c37d34
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Australia
Southeast","Slice":"E","Ring":"4","ScaleUnit":"000","RoleInstance":"ML1PEPF0000E49B"}}
x-ms-resource-unit : 1
Cache-Control : no-cache
Date : Tue, 21 Nov 2023 04:48:55 GMT

Body:
{
"error": {
"code": "Request_ResourceNotFound",
"message": "Resource '' does not exist or one of its queried reference-property
objects are not present.",
"innerError": {
"date": "2023-11-21T04:48:55",
"request-id": "486d4b6e-4b6a-4e8f-b7f3-0b66d8c37d34",
"client-request-id": "486d4b6e-4b6a-4e8f-b7f3-0b66d8c37d34"
}
}
}

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://graph.microsoft.com/v1.0/servicePrincipals?$filter=appId eq ''

Headers:
x-ms-client-request-id : 128e160e-efef-4d0a-99d7-71a3f8a62f21
accept-language : en-US

Body:

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

Status Code:
OK

Headers:
Transfer-Encoding : chunked
Strict-Transport-Security : max-age=31536000
request-id : 47d2f81a-f0d0-4ef8-9bb6-0e1861ae339d
client-request-id : 47d2f81a-f0d0-4ef8-9bb6-0e1861ae339d
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Australia
Southeast","Slice":"E","Ring":"4","ScaleUnit":"000","RoleInstance":"ML1PEPF0000E49B"}}
x-ms-resource-unit : 1
OData-Version : 4.0
Cache-Control : no-cache
Date : Tue, 21 Nov 2023 04:48:55 GMT

Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#servicePrincipals",
"value": [
{
"id": "xxxxxxxxxxxxxx",
"deletedDateTime": null,
"accountEnabled": true,
"alternativeNames": [],
"appDisplayName": "",
"appDescription": null,
"appId": "",
"applicationTemplateId": null,
"appOwnerOrganizationId": "",
"appRoleAssignmentRequired": false,
"createdDateTime": "2018-12-13T01:43:15Z",
"description": null,
"disabledByMicrosoftStatus": null,
"displayName": "",
"homepage": "http://",
"loginUrl": null,
"logoutUrl": null,
"notes": null,
"notificationEmailAddresses": [],
"preferredSingleSignOnMode": null,
"preferredTokenSigningKeyThumbprint": null,
"replyUrls": [],
"servicePrincipalNames": [
"",
"http://"
],
"servicePrincipalType": "Application",
"signInAudience": "AzureADMyOrg",
"tags": [],
"tokenEncryptionKeyId": null,
"samlSingleSignOnSettings": null,
"addIns": [],
"appRoles": [],
"info": {
"logoUrl": null,
"marketingUrl": null,
"privacyStatementUrl": null,
"supportUrl": null,
"termsOfServiceUrl": null
},
"keyCredentials": [],
"oauth2PermissionScopes": [
{
"adminConsentDescription": "Allow the application to access
on behalf of the signed-in user.",
"adminConsentDisplayName": "Access ",
"id": "7f695a25-6e04-42cb-abd5-7628f13608d0",
"isEnabled": true,
"type": "User",
"userConsentDescription": "Allow the application to access
on your behalf.",
"userConsentDisplayName": "Access ",
"value": "user_impersonation"
}
],
"passwordCredentials": [
{
"customKeyIdentifier": null,
"displayName": null,
"endDateTime": "2019-12-13T01:43:13.8861127Z",
"hint": null,
"keyId": "xxxxxxxxxxxxxx",
"secretText": null,
"startDateTime": "2018-12-13T01:43:13.8861127Z"
}
],
"resourceSpecificApplicationPermissions": [],
"verifiedPublisher": {
"displayName": null,
"verifiedPublisherId": null,
"addedDateTime": null
}
}
]
}

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/ed36e373-13fc-42ec-93f4-38a6e84754f0/resourceGroups/
/providers/Microsoft.Sql/servers//administrators/Ac
tiveDirectory?api-version=2020-11-01-preview

Headers:
x-ms-client-request-id : 128e160e-efef-4d0a-99d7-71a3f8a62f21
accept-language : en-US

Body:
{
"properties": {
"login": "",
"sid": "",
"tenantId": ""
}
}

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

Status Code:
BadRequest

Headers:
Pragma : no-cache
x-ms-request-id : 4677bad1-d5d4-442c-9d00-9ba89565cefd
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id : 816ffee0-b5ff-4683-9572-0f682787b5e9
x-ms-routing-request-id : AUSTRALIAEAST:20231121T044855Z:816ffee0-b5ff-4683-9572-0f682787b5e9
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
X-Cache : CONFIG_NOCACHE
X-MSEdge-Ref : Ref A: 78090EC21C684F4EB318C87D28A29F28 Ref B: SYD03EDGE2008 Ref C:
2023-11-21T04:48:55Z
Cache-Control : no-cache
Date : Tue, 21 Nov 2023 04:48:55 GMT

Body:
{
"error": {
"details": [
{
"code": "InvalidResourceIdSegment",
"message": "",
"target": "parameters.properties"
}
],
"code": "InvalidResourceIdSegment",
"message": "The 'parameters.properties' segment in the url is invalid."
}
}

DEBUG: 3:48:56 PM - [ConfigManager] Got nothing from [DisableErrorRecordsPersistence], Module = [], Cmdlet = [].
Returning default value [False].
DEBUG: 3:48:56 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning
default value [True].
Set-AzSqlServerActiveDirectoryAdministrator : The 'parameters.properties' segment in the url is invalid.
At line:1 char:1
+ Set-AzSqlServerActiveDirectoryAdministrator -ResourceGroupName ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzSqlServer...ryAdministrator], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Cmdlet.SetAzureSqlServer
ActiveDirectoryAdministrator

DEBUG: 3:48:56 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
Returning default value [True].
DEBUG: 3:48:56 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: 3:48:56 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default
value [True].
DEBUG: AzureQoSEvent: Module: Az.Sql:4.11.0; CommandName: Set-AzSqlServerActiveDirectoryAdministrator; PSVersion:
5.1.20348.2110; IsSuccess: False; Duration: 00:00:00.9314588; Exception: The 'parameters.properties' segment in the url
is invalid.;
DEBUG: 3:48:56 PM - SetAzureSqlServerActiveDirectoryAdministrator end processing.
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 5.1.20348.2110
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.2110
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.13.2 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}
Script 4.11.0 Az.Sql {Add-AzSqlDatabaseToFailoverGroup, Add-AzSqlElasticJobStep, Add-AzSqlEl...
```

### Error output

```PowerShell
RequestId : 61373d43-d262-4c72-bb23-b6b92e55320f
Message : The 'parameters.properties' segment in the url is invalid.
ServerMessage : InvalidResourceIdSegment: The 'parameters.properties' segment in the url is invalid.
(System.Collections.Generic.List`1[Microsoft.Rest.Azure.CloudError])
ServerResponse : {BadRequest}
RequestMessage : {PUT https://management.azure.com/subscriptions/ed36e373-13fc-42ec-93f4-38a6e84754f0/resourceGroups/
/providers/Microsoft.Sql/servers//admi
nistrators/ActiveDirectory?api-version=2020-11-01-preview}
InvocationInfo : {Set-AzSqlServerActiveDirectoryAdministrator}
Line : Set-AzSqlServerActiveDirectoryAdministrator -ResourceGroupName
-ServerName -DisplayName
-ObjectId
Position : At line:1 char:1
+ Set-AzSqlServerActiveDirectoryAdministrator -ResourceGroupName ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace : at Microsoft.Azure.Management.Sql.ServerAzureAdAdministratorsOperations.d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Sql.ServerAzureAdAdministratorsOperations.d__
6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at
Microsoft.Azure.Management.Sql.ServerAzureAdAdministratorsOperationsExtensions.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Sql.ServerAzureAdAdministratorsOperationsExtensions.CreateOrUpdate(IServerAzureAdA
dministratorsOperations operations, String resourceGroupName, String serverName, ServerAzureADAdministrator
parameters)
at Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Services.AzureSqlServerActiveDirectoryAdminis
tratorAdapter.UpsertServerActiveDirectoryAdministrator(String resourceGroup, String serverName,
AzureSqlServerActiveDirectoryAdministratorModel model)
at Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Cmdlet.SetAzureSqlServerActiveDirectoryAdmini
strator.PersistChanges(IEnumerable`1 entity)
at Microsoft.Azure.Commands.Sql.Common.AzureSqlCmdletBase`2.<>c__DisplayClass16_0.b__0()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ConfirmAction(String processMessage, String
target, Action action)
at Microsoft.Azure.Commands.Sql.Common.AzureSqlCmdletBase`2.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
```

Contributor guide

Open the contributing guide

Research direction

Start at the Set-AzSqlServerActiveDirectoryAdministrator command entry point and compare its Az.Sql 4.10.0 and 4.11.0 behavior, using the supplied PowerShell script and debug request as the reproduction. Trace the generated request and parameters.properties handling, then verify that the same parameters succeed and add or update regression coverage if the relevant test location is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, powershell, sql
Domain
backend-api-design, cloud, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.