Getting Access Denied error while Installing MSSQL Server on Windows server

Getting below error “Access Denied” error while Installing MSSQL Server on Windows server.

Error log :-

“Error: Action "Microsoft.SqlServer.Configuration.SmartSetupExtension.SearchUpdatesAction" threw an exception during execution.”,
“Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) —> System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))”

Ansible Playbook :

  • name: Execute MSSQL installer
    ansible.windows.win_command: “E:\SQLServer2022_Install\setup.exe /ConfigurationFile=E:\SQLServer2022_Install\SQL2022_ConfigurationFile.INI”
    vars:
    become: true
    become_method: runas
    become_user: Administrator
    ansible_user : “{{ keeper_username.value }}”
    ansible_password : “{{ keeper_password.value }}”
    become_flags: logon_type=new_credentials logon_flags=netcredentials_only

try adding /UpdateEnabled=False to your command (after /ConfigurationFile)

1 Like

Thx a lot @watsonb. You are genius. I really appreciate your help in this case. :slight_smile:

1 Like

There’s a few problems here

  • become, become_method, become_flags are all task directives and not vars
  • you are using become flags which are designed for network authentication not bypassing DPAPI restrictions you typically see with the SQL installer
  • you need to set a password for the become user

An example:

- ansible.windows.win_command: foo
  become: true
  become_method: runas
  vars:
    ansible_become_user: '{{ keeper_username.value }}'
    ansible_become_password: '{{ keeper_password.value }}'

This sets become and become_method as the task directives so the task is actually run with become. It also sets the become credentials to the same as your connection credentials without an extra flags.

1 Like