@@ -106,7 +106,9 @@ func NewAzureClientWithDeviceAuth(env azure.Environment, subscriptionID string)
106106 }
107107 }
108108
109- client := & autorest.Client {}
109+ client := & autorest.Client {
110+ PollingDuration : 1 * time .Hour ,
111+ }
110112
111113 deviceCode , err := adal .InitiateDeviceAuth (client , * oauthConfig , acsEngineClientID , env .ServiceManagementEndpoint )
112114 if err != nil {
@@ -301,6 +303,21 @@ func getClient(env azure.Environment, subscriptionID, tenantID string, armSpt *a
301303 c .deploymentsClient .PollingDelay = time .Second * 5
302304 c .resourcesClient .PollingDelay = time .Second * 5
303305
306+ // Set permissive timeouts to accommodate long-running operations
307+ c .deploymentsClient .PollingDuration = time .Hour * 1
308+ c .deploymentOperationsClient .PollingDuration = time .Hour * 1
309+ c .applicationsClient .PollingDuration = time .Hour * 1
310+ c .authorizationClient .PollingDuration = time .Hour * 1
311+ c .disksClient .PollingDuration = time .Hour * 1
312+ c .groupsClient .PollingDuration = time .Hour * 1
313+ c .interfacesClient .PollingDuration = time .Hour * 1
314+ c .providersClient .PollingDuration = time .Hour * 1
315+ c .resourcesClient .PollingDuration = time .Hour * 1
316+ c .storageAccountsClient .PollingDuration = time .Hour * 1
317+ c .virtualMachineScaleSetsClient .PollingDuration = time .Hour * 1
318+ c .virtualMachineScaleSetVMsClient .PollingDuration = time .Hour * 1
319+ c .virtualMachinesClient .PollingDuration = time .Hour * 1
320+
304321 graphAuthorizer := autorest .NewBearerAuthorizer (graphSpt )
305322 c .applicationsClient .Authorizer = graphAuthorizer
306323 c .servicePrincipalsClient .Authorizer = graphAuthorizer
@@ -310,7 +327,8 @@ func getClient(env azure.Environment, subscriptionID, tenantID string, armSpt *a
310327
311328// EnsureProvidersRegistered checks if the AzureClient is registered to required resource providers and, if not, register subscription to providers
312329func (az * AzureClient ) EnsureProvidersRegistered (subscriptionID string ) error {
313- ctx := context .Background ()
330+ ctx , cancel := context .WithTimeout (context .Background (), 1 * time .Hour )
331+ defer cancel ()
314332 registeredProviders , err := az .providersClient .List (ctx , to .Int32Ptr (100 ), "" )
315333 if err != nil {
316334 return err
0 commit comments