question

VijayKumar768 avatar image
0 Votes"
VijayKumar768 asked VijayKumar768 commented

Getting Error while enabling Audit on Azure SQL DB

Hi Team,

I am using below Powershell script:

Set-AzureRmSqlDatabaseAuditing -ResourceGroupName "resourcegroup123"
-ServerName "sqlazureserver1234.database.windows.net" -DatabaseName "db123"
-StorageAccountName "storage1234"
-AuditActionGroup "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", "FAILED_DATABASE_AUTHENTICATION_GROUP", "BATCH_COMPLETED_GROUP"
-AuditAction "SELECT ON DBO.ALWNC_HDR BY public"
-AuditAction "DELETE ON DBO.ALWNC_HDR BY public"
-AuditAction "UPDATE ON DBO.ALWNC_HDR BY public"
-AuditAction "INSERT ON DBO.ALWNC_HDR BY public"
-AuditAction "SELECT ON DBO.BILL_REC_HDR BY public"
-AuditAction "DELETE ON DBO.BILL_REC_HDR BY public"
-AuditAction "UPDATE ON DBO.BILL_REC_HDR BY public"
-AuditAction "INSERT ON DBO.BILL_REC_HDR BY public"
-RetentionInDays 8

Here is the error:
Set-AzureRmSqlDatabaseAuditing : The term 'Set-AzureRmSqlDatabaseAuditing' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ Set-AzureRmSqlDatabaseAuditing -ResourceGroupName "az-entaks-nonprod- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-AzureRmSqlDatabaseAuditing:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

azure-sql-database
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AlbertoMorillo avatar image
0 Votes"
AlbertoMorillo answered VijayKumar768 commented

Please install the AzureRM.Sql PowerShell module first.

Be aware that Microsoft will retire AzureRM PowerShell modules on 29 February 2024, in favor of the Az PowerShell modules. Try to



· 10
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Got below error :

PS C:\WINDOWS\system32> Install-Module -Name AzureRM.Sql -RequiredVersion 4.12.1
PackageManagement\Install-Package : The following commands are already available on this system:'Login-AzAccount,Logout-AzAccount,Resolve-Error,Send-Feedback'. This module 'AzureRM.Profile' may override
the existing commands. If you still want to install this module 'AzureRM.Profile', use -AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711 char:34
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage.


Still getting same error:
Set-AzureRmSqlDatabaseAuditing : The term 'Set-AzureRmSqlDatabaseAuditing' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ Set-AzureRmSqlDatabaseAuditing -ResourceGroupName "az-entaks-nonprod- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-AzureRmSqlDatabaseAuditing:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

0 Votes 0 ·

I am sorry. My fault.

Please login first as shown below:

 Login-AzureRmAccount

Then install this.

 Install-Module AzureRm




0 Votes 0 ·

I will go to sleep for 3-4 hours and will be back in 6 hours more or less.

0 Votes 0 ·

Thank you. Please take care.

Anyway, i made some progress. Will let you know more info.

0 Votes 0 ·
Show more comments