azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Set-AzureRmResource "hangs" when updating tags on paused AnalysisServices

Open SiloReed opened this issue 9 years ago • 9 comments

Cmdlet(s)

PowerShell Version

5.1.15063.296

Module Version

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Set-AzureRmResource                                4.0.0      AzureRM.Resources

OS Version

10.0.15063.296

Description

I the Analysis Services server is paused, the Set-AzureRmResource cmdlet hangs for over an hour.

Debug Output

DEBUG: [Common.Authentication]: Authenticating using Account: '####@####.com', environment: 'AzureCloud', tenant: '########-####-####-####-############'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: '########-####-####-####-############', Endpoint: 'https://login.microsoftonline.com/', ClientId: '########-####-####-####-############', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthrity: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.com/########-####-####-####-############/', CorrelationId: '00000000-0000-0000-0000-000000000000', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: '########-####-####-####-############', AdEndpoint: 'https://login.microsoftonline.com/', ClientId: '########-####-####-####-############', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 06/09/2017 18:06:00:########-####-####-####-############ - AcquireTokenHandlerBase: === Token Acquisition started:
	Authority: https://login.microsoftonline.com/########-####-####-####-############/
	Resource: https://management.core.windows.net/
	ClientId: ########-####-####-####-############
	CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (1 items)
	Authentication Target: User
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 06/09/2017 18:06:00:########-####-####-####-############ - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 06/09/2017 18:06:00:########-####-####-####-############ - TokenCache: An item matching the requested resource was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 06/09/2017 18:06:00:########-####-####-####-############ - TokenCache: 44.4331320816667 minutes left until token in cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 06/09/2017 18:06:00:########-####-####-####-############ - TokenCache: A matching item (access token or refresh token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 06/09/2017 18:06:00:########-####-####-####-############ - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
	Access Token Hash: ############################################
	Refresh Token Hash: ############################################
	Expiration Time: 06/09/2017 18:50:26 +00:00
	User Hash: ############################################
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 06/09/2017 18:06:00:  - TokenCache: Serializing token cache with 1 items.
DEBUG: [Common.Authentication]: Received token with LoginType 'LiveId', Tenant: '########-####-####-####-############', UserId: '####@####.com'
DEBUG: [Common.Authentication]: Renewing Token with Type: 'Bearer', Expiry: '06/09/2017 18:50:26 +00:00', MultipleResource? 'True', Tenant: '########-####-####-####-############', UserId: '####@####.com'
DEBUG: [Common.Authentication]: User info for token DisplayId: '####@####.com', Name: Jeff Reed, IdProvider: 'https://sts.windows.net/########-####-####-####-############/', Uid: 'e0a4335a-6dc4-4ca8-9eaf-ac964ff04dc3'
DEBUG: [Common.Authentication]: Checking token expiration, token expires '06/09/2017 18:50:26 +00:00' Comparing to '06/09/2017 18:06:00 +00:00' With threshold '00:05:00', calculated time until token expiry: '00:44:25.9869253'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/########-####-####-####-############/resourceGroups/rg-ASTest/providers/Microsoft.AnalysisServices/servers/azrastst01?api-version=2016-05-16

Headers:
User-Agent                    : AzurePowershell/v4.0.0.0,PSVersion/v5.1.15063.296
ParameterSetName              : Resource that resides at the subscription level.
CommandName                   : Set-AzureRmResource

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

Status Code:
OK

Headers:
Pragma                        : no-cache
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-request-id               : 0b34c0aa-4cd9-4626-8cc6-79c4f33c16d1
x-ms-current-utc-date         : 6/9/2017 6:06:01 PM
x-ms-ratelimit-remaining-subscription-reads: 14968
x-ms-correlation-request-id   : 3ea1ced0-8102-49a4-85bb-e9cd439563c7
x-ms-routing-request-id       : EASTUS2:20170609T180601Z:3ea1ced0-8102-49a4-85bb-e9cd439563c7
Cache-Control                 : no-cache
Date                          : Fri, 09 Jun 2017 18:06:00 GMT
Server                        : Microsoft-HTTPAPI/2.0

Body:
{
  "properties": {
    "provisioningState": "Paused",
    "state": "Paused",
    "serverFullName": "asazure://aspaaseastus2.asazure.windows.net/azrastst01",
    "managedMode": 1,
    "backupBlobContainerUri": "https://saazrastst01.blob.core.windows.net/contazrastst01"
  },
  "id": "/subscriptions/########-####-####-####-############/resourceGroups/rg-ASTest/providers/Microsoft.AnalysisServices/servers/azrastst01",
  "name": "azrastst01",
  "type": "Microsoft.AnalysisServices/servers",
  "location": "East US 2",
  "sku": {
    "name": "D1",
    "tier": "Development"
  },
  "tags": {
    "Test": "This is a test"
  }
}

Script/Steps for Reproduction

This script shows the differences between setting the tags on virtual machines, SQL databases and Analysis Services servers

$DebugPreference = "Continue"
$MyKey = "Test"
$MyValue = "This is a test"

$resources = @()

$resources += @{
    ResourceType      = 'Microsoft.Compute/virtualMachines'
    ResourceName      = 'ubuntu01'
    ResourceGroupName = 'rg-ubuntu01'
}

$resources += @{
    ResourceType      = "Microsoft.Sql/servers/databases"
    ResourceName      = 'azrodstst01/AZDWTST01'
    ResourceGroupName = 'rg-ASTest'

}

$resources += @{
    ResourceType      = 'Microsoft.AnalysisServices/servers'
    ResourceName      = 'azrastst01'
    ResourceGroupName = 'rg-ASTest'

}
$resources | ForEach-Object {

    $tags = (Get-AzureRmResource -ResourceName $_.ResourceName -ResourceGroupName $_.ResourceGroupName -ResourceType $_.ResourceType).Tags

    if ($tags -eq $Null) {
        # Tags property didn't exist so set the tags to my tag
        $tags = $MyTag
    }
    else {
        # Check if the tag already exists
        if ($tags.ContainsKey($MyKey) )  {
            # The tag exists so update it
            $tags.Set_Item($MyKey, $MyValue)
        }
        else {
            # The tag doesn't exist in the tags collection so add a new tag
            $tags.Add($MyKey, $MyValue)
        }
    }


    $params = @{
        ResourceType      = $_.ResourceType                                                                                                                                                           
        ResourceName      = $_.ResourceName                                                                                                                                                                                     
        ResourceGroupName = $_.ResourceGroupName
        Tag               = $tags                                                                                                                                                                                 
        Force             = $True
        UsePatchSemantics = $True
    }

    Measure-Command {Set-AzureRmResource @params}
    }

SiloReed avatar Jun 09 '17 18:06 SiloReed

@ravbhatnagar Hey Gaurav, would you mind taking a look at this issue?

cormacpayne avatar Jun 09 '17 20:06 cormacpayne

Hi, do you have some updates for that issue? I have the same Problem in my environment!

Regards, Hannes

gruenerh avatar Jul 24 '17 14:07 gruenerh

@taiwu would you mind taking a look at this issue? It seems that the service isn't allowing the user to update a property on a paused AnalysisServices server

cormacpayne avatar Jul 03 '18 22:07 cormacpayne

@taiwu @athipp @pychuang would one of you be able to take look at this issue?

cormacpayne avatar Nov 14 '18 00:11 cormacpayne

Just seeing this issue, I need to verify with our team to check if updating tags for paused server is allowed. If it is, I will fix it.

taiwu avatar Nov 14 '18 01:11 taiwu

Update: A fix is being proposed and worked on for this issue.

minghan avatar Nov 22 '18 15:11 minghan

This is a AAS RP bug where the RP returns incorrect provisioningState, resulting in an infinite loop/wait in the Set-AzureRmResource cmdlet.; A fix is being worked on and is tracked by https://powerbi.visualstudio.com/Analysis%20Services/_workitems/edit/137129 (Microsoft internal only).

ETA for fix is late December 2018.

minghan avatar Nov 24 '18 11:11 minghan

Fixed has been checked in to Azure Analysis Services service code and will be deployed by 1/18/2019. Feel free to re-open the bug if the issue persists after 1/18/2019. Thanks.

minghan avatar Nov 27 '18 08:11 minghan

I am new to this can someone help me in understanding how to get this fix

ausafonly avatar Jan 08 '20 16:01 ausafonly