Code Monkey home page Code Monkey logo

d365fo.tools's People

Contributors

alexhimself avatar alpa-chino avatar batetech avatar caleblanchard avatar colind-work avatar dodiggitydag avatar fh-inway avatar fharin avatar fhoo avatar gertvdh avatar goshoom avatar ievgenm avatar ismits avatar itrasmus avatar jeroeneikmans avatar jspijkerboer avatar kennysaelen avatar onikolaiev avatar orangutech avatar paulheisterkamp avatar richardsondev avatar rowdynl avatar scifimiki avatar shashisadasivan avatar shind44 avatar skaue avatar smholvoet avatar splaxi avatar thugpotato avatar vincentverweij avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

d365fo.tools's Issues

Invoke-D365DBSync error

If I use the following command:

Invoke-D365DBSync -DatabaseServer "DENUE--AX-QRA15" -DatabaseName "AXDB" -SqlUser "sqlAdmin" -SqlPwd "LokalCosm0123!" -LogPath "C:\AOSService\PackagesLocalDirectory_logs" -Verbose

I get the following error:
VERBOSE: CommandFile \bin\SyncEngine.exe
VERBOSE: Parameters -syncmode=fullall -verbosity=normal -metadatabinaries=""
-connect="server=DENUE--AX-QRA15;Database=AXDB;Trusted_Connection=false; User Id=;Password=;"
Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:88 char:16

  • ... $process = Start-Process -FilePath $command -ArgumentList $param -P ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
    • FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

VERBOSE: Process Started
Write-Verbose : Cannot bind argument to parameter 'Message' because it is null.
At line:93 char:19

  • Write-Verbose $process
    
  •               ~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Write-Verbose], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.WriteVerbos
      eCommand

Time Taken for sync:
00:00:00.0019951

it seems to me that the sqlUser and the sqlPwd are not recognized

Import-D365AadUser SQL error

When I try to run
Import-D365AadUser -UserList $UserEmail -Verbose
I have got the following

...
VERBOSE: Import the user
VERBOSE: Adding User : [email protected],Glib Holovin,glib.holovin,S-1-19-290.....192,DAT,https://sts.windows.net/,https://sts.windows.net/
VERBOSE: Creating the user in database
VERBOSE: Rows inserted  1 for user [email protected]
VERBOSE: Setting security roles in D365FO database
Exception calling "ExecuteScalar" with "0" argument(s): "Violation of PRIMARY KEY constraint 'I_65492RECIDIDX'. Cannot insert duplicate key in object 'dbo.SECURITYUSERROLE'. The duplicate key value is (5637244459).
The statement has been terminated."
At line:12 char:5
+     $differenceBetweenNewUserAndAdmin = $sqlCommand.ExecuteScalar()
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SqlException
 
VERBOSE: Difference between new user and admin security roles 
Import-AadUserIntoD365FO : User [email protected] did not get securityRoles
At line:195 char:9
+         Import-AadUserIntoD365FO $SqlCommand $user.SignInName $name $ ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException

Looks like SQL code is OK for AX2012, but for D365FFO you don't need anymore to retrieve the next RecId. Just insert a new row and SQL will automatically increment RecId field.

Implement new parameter -CustomSql for new-d365bacpac

Before exporting the copied database, we need to delete tables that take up too much memory and are not required (history tables).
This reduces our Azure database by several GB.
I suggest a parameter called "Truncate" with a table list,
e.g. -Truncate Batch, BatchHistory, BatchJobHistory, DatabaseLog, SysDatabaseLog etc.

Implement Invoke-D365DataFlush

Create a cmdlet that has all special flush classes as a separate switch

SysFlushData
SysFlushAod
SysDataCacheParameters

Allow for TrustedConnection when on OneBox

Any database connection while on OneBox shouldn't depend on username and password (SQL User), but allow for Windows Authentication by simply omitting the SQL User credentials and letting it connect using TrustedConnection. That way, for many scenarios, we do not have to gather the SQL User credentials from LCS to get started with several database related operations on OneBox environments.

Run as Administrator

Functions relying on sql user password from AOS configuration, requires to be run as Administrator.
Functions should validate that a password is specified when it isn't running as Administrator

Reuse of passwords when importing database

When you Import the database to Tier 1 from Tier2, according to MS docs (earlier version), you need to run a SQL script for prepare the target database with the correct credentials. Part of this step is to create the database users, with passwords from LCS. However, one can just as easily simply create the users from the existing SQL Server instance. This removes the dependency to having the passwords gathered from LCS.

So instead of:
CREATE USER axruntimeuser WITH password 'abc'

You can use:
CREATE USER axruntimeuser FROM LOGIN axruntimeuser

This is now reflected on the docs, and so should the SQL run in d365fo.tools
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/database/copy-database-from-azure-sql-to-sql-server

:-)

Implement Enable-D365User

Implement Enable-D365User

Please implement the ability to streamline the re-activation of an environment after database refresh from PROD to sandbox environment. We always have activated the users by execution SQL-Statements like this:
update userinfo set enable = 1 where ID = 'sys-ax-batch'

To get a similar “interface” for this new functions as it exists Update-D365User I would suggest to use the same parameters. So an sample call would be:
Enable-D365User -Email "[email protected]"
Enable-D365User -Email "%contoso.com%"

Implement storing of configuration (SQLUser / SQLPWD / URL)

We plan on using the PSFramework to implement a simple solution to store default configuration details on the machine.

Use case suggestions:

  • Personale workstations (non-onebox / developer machines)
    • For all cmdlets that use a URL, enable the option to store the URL for your preferred environment. Would ease the usability of Invoke-D365TableBrowser, Invoke-D365SysRunnerClass and other relevant cmdlets
  • Tier 2 environments
  • Make it easier to just run either New-D365Bacpac or Import-D365Bacpac, because we could store the needed SqlUser and SqlPwd values from LCS. This would eliminate the need for storing environment specific commands and increase the usability because you could run most commands with default parameters.

The thought is that the first time we install the module on a machine, the user could run Set-D365MachineConfig -Url XYZ -SqlUser XYZ -SqlPwd XYZ and have the module store these informations. When getting back and starting a cmdlet that needs these details the module would pick them up and you wouldn't have specify the parameters.

Document how to give access to aosservice - Write wiki

Add-NTFSAccess -Path C:\AOSService -Account administrator -AccessRights FullControl -AccessType Allow -InheritanceFlags ContainerInherit

Get-ChildItem -Path C:\AOSService -Recurse | Add-NTFSAccess -Account administrator -AccessRights FullControl -AccessType Allow -InheritanceFlags ContainerInherit

Add-NTFSAccess -Path 'C:\Windows\System32\inetsrv\config' -Account administrator -AccessRights FullControl -AccessType Allow -InheritanceFlags ContainerInherit

maybe we need to give access to these
C:\Windows\WinSxS\amd64_microsoft-windows-iis-sharedlibraries_31bf3856ad364e35_10.0.14393.1198_none_86ae9b2a0f5f134e\redirection.config
C:\Windows\WinSxS\amd64_microsoft-windows-iis-sharedlibraries_31bf3856ad364e35_10.0.14393.1613_none_8670fb260f8e5426\redirection.config

Import-D365Aaduser not working

I just tried the import-D365Aaduser and it throwed me an error. Screenshot attached. Launched powershell as Admin
DB owner access to AXDB for local admin account
AAD user whose creds given when running the script has sysadmin

This is a cloud-hosted tier1 box
error

New-D365Bacpac has problemes with = in SqlPwd

If you have a SqlPwd like this "=B5*=ABCD**XXX" you will receive the following error when using New-D365Bacpac.

Exception setting "ConnectionString": "Keyword not supported: 'password=b5*'."
At line:38 char:5

  • $sqlConnection.ConnectionString = ($Params -join "")
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
  • FullyQualifiedErrorId : ExceptionWhenSetting

image

Ability to add custom commands to ..\internal\sql\clear-azurebacpacdatabase.sql

We need the ability to add custom commands to ..\internal\sql\clear-azurebacpacdatabase.sql for the process of "Automate the creation of bacpac from a Tier 2 (MS hosted) environment" because we have to DROP FULLTEXT STOPLIST before export starts. I´m not that familiar with PowerShell, so I don´t know if it’s possible to implement “hook points”…
Currently I´m modifying the file after installation of the module.

D365FO Sequences

As mentioned by valerymoskalenko in issue #36

Inserting records into D365FO, should use the Sequences used in SQL server instead of the old SYSTEMSEQUENCE Table.

The Sequence is named like SEQ_TABLEID

Improve Set-D365StartPage command

Please extend the command, so it will do few more steps:

  1. Show Favorites bar in IE
  2. Lock the Favorites Toolbar
    image
  3. Add new favorites with the name "D365FO" and url equal to the current instance. End result will look like this:
    image

Import-D365Bacpac -ImportModeTier2 get an error

If you want to use Import-D365Bacpac -ImportModeTier2 you will receive the follwing error:
Import-D365Bacpac : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1

  • Import-D365Bacpac -ImportModeTier2
  •   + CategoryInfo          : InvalidArgument: (:) [Import-D365Bacpac], ParameterBindingException
      + FullyQualifiedErrorId : AmbiguousParameterSet,Import-D365Bacpac
    

Set permissions on services - write wiki

Install-Module carbon -AllowClobber
Import-Module carbon

Grant-ServiceControlPermission -ServiceName Microsoft.Dynamics.AX.Framework.Tools.DMF.SSISHelperService.exe -Identity administrator

Grant-ServiceControlPermission -ServiceName DynamicsAxBatch -Identity administrator

Grant-ServiceControlPermission -ServiceName MR2012ProcessService -Identity administrator

Grant-ServiceControlPermission -ServiceName w3svc -Identity administrator

A command with name 'Get-LastResult' is already available on this system.

While installing d365fo.tools with the command Install-Module -Name d365fo.tools I´m getting the error following error. This is a brand new 1611 VM with only PowerShell-Module installed for Visual Studio-TFS integration.

PackageManagement\Install-Package : A command with name 'Get-LastResult' is already available on this system. This
module 'd365fo.tools' may override the existing commands. If you still want to install this module 'd365fo.tools', use
-AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21

  • ... $null = PackageManagement\Install-Package @PSBoundParameters
  •                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],
      Exception
    • FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Implement PSFramework

PSFramework can help us with having configuration files persisted to storage, that survives sessions over time.

It provides a powerfull message framework that can replace -verbose in a way were we get a historical verbose message implementation. It means we don't need to run the cmdlet again, to see what went wrong - it will be recorded even when running the cmdlet normally.

Implement Label XRef Search (DB)

SELECT TOP 1000
N.[Id] AS XRefIdLabel
,N.[Path] AS XRefLabelPath
,N.[ProviderId] AS XRefLabelProvider
,M.Module AS XRefLabelModule
, R.SourceId AS CodeReferenceId
, N2.[Path] AS CodeReferencePath
, M2.Module AS CodeReferenceModule
FROM [DYNAMICSXREFDB].[dbo].[Names] AS N
INNER JOIN [dbo].[Modules] AS M ON N.ModuleId = M.Id
INNER JOIN [dbo].[References] AS R on N.Id = R.TargetId
INNER JOIN [DYNAMICSXREFDB].[dbo].[Names] AS N2 ON R.SourceId = N2.Id
INNER JOIN [dbo].[Modules] AS M2 ON N2.ModuleId = M2.Id
WHERE N.[Path] LIKE '/Labels/@SYS330300

After the SQL Select - use the details to find the xml files for the given object and show details. Support number of lines to show, and either before, after or both switch.

New-D365Bacpac seems to have changed arguments for ExecutionMode

New-D365Bacpac -ExecutionMode FromSql -DatabaseServer localhost -DatabaseName AxDB -SqlUser sqluser -SqlPwd "pwd" -BackupDirectory J:\MSSQL_BACKUP\ -NewDatabaseName AxDB_EXPORTCOPY -BacpacDirectory J:\MSSQL_BACKUP\ -BacpacName bacpacname

This command fails as the -ExecutionMode parameter cannot be found. Is it possible that this has been renamed as I see ExportModeTier1 and ExportModeTier2 but when using these it does not find the parameter set?

Change Owner on crypto keys - write wiki

install-Module ntfssecurity -AllowClobber
import-Module ntfssecurity

Set-NTFSOwner -Path C:\ProgramData\Microsoft\Crypto -Account administrator

Get-ChildItem -Path C:\ProgramData\Microsoft\Crypto -Recurse | Add-NTFSAccess -Account administrator -AccessRights FullControl -AccessType Allow -InheritanceFlags ContainerInherit

Fix broken VS debugging

When renaming a local VM (onebox) it breaks the VS debugging process.

A fix found by others:

Following files needed to be updated with correct spn id and url.

  1. Documents/vs 2015/settings/*.xml files (typically either defaultconfig.xml or dynamicsdevconfig.xml)
  2. C:\aosservice\packageslocaldirectory\bin\defaultdevconfig.xml

Suggestion: Consider split this up in multiple lines to avoid horizontal scrolling

This is more of a developer preference thing, trying to avoid code that requires horizontal scrolling.

$AzureParams = @{AxDeployExtUserPwd = $AxDeployExtUserPwd; AxDbAdminPwd = $AxDbAdminPwd; AxRuntimeUserPwd = $AxRuntimeUserPwd; AxMrRuntimeUserPwd = $AxMrRuntimeUserPwd; AxRetailRuntimeUserPwd = $AxRetailRuntimeUserPwd; AxRetailDataSyncUserPwd = $AxRetailDataSyncUserPwd}

Replace ; with linebreaks instead. ;-)

Issue using Rename-D365Instance

When using this command on a onebox dev vm I get the following error message.

Cannot find an overload for "Replace" and the argument count: "2".
At line:2 char:5

  • (Get-Content $File).replace($OldValue, $NewValue) | Set-Content $ ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodException
    • FullyQualifiedErrorId : MethodCountCouldNotFindBest

The message appears three times and IIS service is restarted and active URL typed (unaltered).

Do I use the tool in the wrong way?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.