-
Notifications
You must be signed in to change notification settings - Fork 102
Old readme examples
This page is a direct copy & paste of the old repository readme page. We have stored all the examples here as a courtesy.
Some of the examples are out-dated, while others are still valid and might not made it into the comment based help for the cmdlet / function itself.
If you find any example here that you believe should be part of the comment based help, please create an issue and tell us. Or even better, create a Pull Request with the example against the repository.
Install-Module -Name d365fo.tools -Scope CurrentUser
Get-Command -Module d365fo.tools
Update-Module -name d365fo.tools
Get-D365ProductInformation
Will list all build numbers available, application and platform
Get-D365InstanceName
Displays the current instance registered on the machine. Run on a machine with the D365 AOS installed on to get an result
Rename-D365Instance -NewName 'Demo1'
Now the machine (iis) will only respond to request for https://demo1.cloud.onebox.dynamics.com
Set-D365StartPage -Name 'Demo1'
Now when starting the browser you will start visit https://demo1.cloud.onebox.dynamics.com
Set-D365Admin "[email protected]"
Please remember that the username / e-mail has to be a valid Azure Active Directory
Import-D365AadUser -Users "[email protected]","[email protected]"
Imports Claire and Allen into the environment
Import-D365AadUser -AadGroupName "D365 Users" -ForceExactAadGroupName
Imports all users included into "D365 Users" Azure AD Group into the environnement
The ForceExactAadGroupName parameter force command to find the AD group by searching for the exact name
Update-D365User -Email "[email protected]"
This will search for the user in the UserInfo table with "[email protected]" e-mail address and update it with the needed details to get access to the environment
Update-D365User -Email "*contoso.com"
This will search for all users in the UserInfo table with the "contoso.com" text in their e-mail address and update them with the needed details to get access to the environment
Enable-D365User -Email "[email protected]"
This will search for the user in the UserInfo table with "[email protected]" e-mail address and set enable = 1 if they are not allready enabled, -verbose will show which users where updated
Enable-D365User -Email "*@contoso.com"
This will search for the user in the UserInfo table with the "@contoso.com" text in their e-mail address and set enable = 1 if they are not allready enabled, -verbose will show which users where updated
Set-D365SysAdmin
This will import the local administrator on the machine into the registered SQL Server.
Notes:You will have to run from an elevated console if you want to avoid supplying username and password
Remove-D365User -Email "[email protected]"
This will remove the user with the email address "[email protected]" and all the configured security roles.
New-D365Bacpac -ExportModeTier1 -DatabaseServer localhost -DatabaseName AxDB -SqlUser User123 -SqlPwd "Password123" -BackupDirectory c:\Temp\backup\ -NewDatabaseName Testing1 -BacpacFile C:\Temp\Bacpac\Testing1.bacpac
This will backup the db database from the localhost server.
It will restore the backup back into the localhost server with a new name "Testing1".
It will clean up the Testing1 database for objects that cannot exist in Azure DB.
It will start the sqlpackage.exe file and export a valid bacpac file.
It will delete the Testing1 database on the localhost server.
New-D365Bacpac -ExportModeTier2 -DatabaseServer dbserver1.database.windows.net -DatabaseName AxDB -SqlUser User123 -SqlPwd "Password123" -BacpacFile C:\Temp\Bacpac\Testing1.bacpac -ExportOnly
This will export an bacpac file directly from the db database from the Azure db instance at dbserver1.database.windows.net.
New-D365Bacpac -ExportModeTier2 -DatabaseServer dbserver1.database.windows.net -DatabaseName AxDB -SqlUser User123 -SqlPwd "Password123" -NewDatabaseName Testing1 -BacpacFile C:\Temp\Bacpac\Testing1.bacpac
This will create a copy of the db database in the Azure db instance at dbserver1.database.windows.net.
It will clean up the Testing1 database for objects that cannot exist in SQL Server.
It will start the sqlpackage.exe file and export a valid bacpac file.
It will delete the Testing1 database in the Azure db instance at dbserver1.database.windows.net.
Import-D365Bacpac -ImportModeTier1 -BacpacFile "C:\temp\uat.bacpac" -NewDatabaseName "ImportedDatabase"
This will import into the registered sql server and create a new "ImportedDatabase" database.
It will import the bacpac file "C:\temp\uat.bacpac" and prepare the database for D365.
Get-D365DatabaseAccess
This will show database connection details that D365FO is configured with
Get-D365DecryptedConfigFile -DropPath 'C:\Temp'
This will store a decrypted web.config file at c:\temp
Get-D365WindowsActivationStatus
This will get the current Windows license and activation status for the machine. It will show how many days left before expiration and how many ReArms there is left
Invoke-D365ReArmWindows -Restart
This will try to rearm the Windows license and will only work if you have retries left. Will restart afterwards.
Invoke-D365DBSync
This utilizes the same mechanism as Visual Studio just in PowerShell and runs the entire synchronization process.
Get-D365Environment
Will list the status of all D365 services on the local machine
Get-D365Environment -ComputerName "TEST-SB-AOS1","TEST-SB-AOS2" -All
Will list the status of all D365 services on the specified machines
Stop-D365Environment
Will stop all D365 services on the local machine. Will report current status for all services
Stop-D365Environment -ComputerName "TEST-SB-AOS1","TEST-SB-AOS2" -All
Will stop all D365 services on the the specified machines. Will report current status for all services
Start-D365Environment
Will start all D365 services on the local machine. Will report current status for all services
Start-D365Environment -ComputerName "TEST-SB-AOS1","TEST-SB-AOS2" -All
Will start all D365 services on the the specified machines. Will report current status for all services
Get-ExposedService -ClientId "YouClientIdFromAppRegistration" -ClientSecret "TheSecretFromTheAppRegistration"
Will return a json containing the exposed services of the D365FO. It is possible to provide
- Authority [Defaulted to current instance identity provider]
- D365FO [Defaulted to current D365FO Enviroment]
Initialize-D365TestAutomationCertificate
Creates a new self signed certificate for automated testing and reconfigures the AOS Windows Identity Foundation configuration to trust the certificate
Get-D365OfflineAuthenticationAdminEmail
Will display the current registered account as Offline Authentication Administrator
Set-D365OfflineAuthenticationAdminEmail -Email "[email protected]"
Will update the Offline Authentication Administrator registration to "[email protected]"
Get-D365ClickOnceTrustPrompt
This will get the current ClickOnce trust prompt configuration on the machine
Set-D365ClickOnceTrustPrompt
This will set the necessary ClickOnce trust prompt configuration on the machine
Get-D365SDPCleanUp
This will display the current retention that is configured on the server. If the result is empty it means that this has never been configured.
Set-D365SDPCleanUp -NumberOfDays 10
This either create or update the cleanup retention in the registry and set it to 10 days.
Notes: Please note that the Set-D365SDPCleanUp requires elevated permissions to work.
Get-D365InstalledPackage
Gets all installed packages on the system/machine
Get-D365InstalledPackage -Name "ApplicationSuite"
Gets the "ApplicationSuite" package
Get-D365InstalledPackage -Name "ApplicationSuite" | Get-D365PackageLabelFile -Language "en-US"
Gets all the "en-US" resource / label files from the ApplicationSuite package
Get-D365InstalledPackage -Name "ApplicationSuite" | Get-D365PackageLabelFile -Language "en-US" -Name "PRO"
Gets the PRO resource / label file from the "ApplicationSuite" package with the language "EN-US"
Get-D365InstalledPackage -Name "ApplicationSuite" | Get-D365PackageLabelFile -Language "en-US" -Name "PRO" | Get-D365Label
Gets all label details from the PRO resource / label file from the "ApplicationSuite" package with the language "EN-US"
Get-D365InstalledPackage -Name "ApplicationSuite" | Get-D365PackageLabelFile -Language "*" -Name "PRO" | Get-D365Label -Name "@PRO505"
Gets the "@PRO505" label details from the "PRO" resource / label file from the "ApplicationSuite" package, across all languages
Get-D365InstalledPackage -Name "ApplicationSuite" | Get-D365PackageLabelFile -Language "en-US" | Get-D365Label -Value "*qty*" -IncludePath
Gets all "en-US" labels where the value contains "qty" from the "ApplicationSuite" package, across all resource / label files
Invoke-D365SysFlushAodCache
Will execute a web call to the SysRunnerClass with the name SysFlushAod class and have the class executed
Invoke-D365TableBrowser -TableName SalesTable -Company "USMF"
Will call the Table Browser in the web browser and display all data from the SalesTable within the "USMF" company
Invoke-D365SysRunnerClass -ClassName SysDBInformation -Company USMF
Will execute a web call to the SysRunnerClass with the SysDBInformation as the parameter and have the class executed against the USMF company
Get-D365Table -Id 10347
Will get the details for the table with the id 10347
Get-D365Table -Name CustTable
Will get the details for the CustTable
Get-D365TableField -TableId 10347
Will get all fields and details for these fields for the table with id 10347
Get-D365TableField -TableName CustTable
Will get all fields and details for these fields for the table CustTable
Get-D365TableField -TableId 10347 -FieldId 175
Will get the details for the field with id 175 that belongs to the table with id 10347
Get-D365TableField -TableId 10347 -Name "VAT*"
Will get the details for all fields that fits the search "VAT" that belongs to the table with id 10347*
Get-D365TableField -Name AccountNum -SearchAcrossTables
Will search for the AccountNum field across all tables.
Get-D365AzureStorageFile -AccountId "miscfiles" -AccessToken "xx508xx63817x752xx74004x30705xx92x58349x5x78f5xx34xxxxx51" -Blobname "backupfiles"
Get all files stored inside the "backupfiles" container / blob in the "miscfiles" storage account
Invoke-D365AzureStorageUpload -AccountId "miscfiles" -AccessToken "xx508xx63817x752xx74004x30705xx92x58349x5x78f5xx34xxxxx51" -Blobname "backupfiles" -Filepath C:\temp\bacpac\UAT_20180701.bacpac -DeleteOnUpload
This will upload the "UAT_20180701.bacpac" file to the specified Azure Storage Account and delete it when completed
Invoke-D365AzureStorageDownload -AccountId "miscfiles" -AccessToken "xx508xx63817x752xx74004x30705xx92x58349x5x78f5xx34xxxxx51" -Blobname "backupfiles" -FileName "UAT_20180701.bacpac" -Path "c:\temp"
This will download the "UAT_20180701.bacpac" file from the Azure Storage Account and store it in "c:\temp\UAT_20180701.bacpac"
Get-D365DotNetClass -Name "ERText*"
This will search across all assembly files (*.dll) located in the package directory for any class that fits the search "ERText*"
Get-D365DotNetClass -Name "ERText*" -Assembly "*LocalizationFrameworkForAx.dll*"
This will search across assembly files (*.dll) that fits the search "*LocalizationFrameworkForAx.dll*", located in the package directory for any class that fits the search "ERText*"
Get-D365DotNetMethod -Assembly "C:\AOSService\PackagesLocalDirectory\ElectronicReporting\bin\Microsoft.Dynamics365.LocalizationFrameworkForAx.dll"
This will search for all methods, across all classes, that exists inside the specified assembly file
Invoke-D365SDPInstall -Path C:\DeployablePackages -Command RunAll
This will execute the generate, import and execute steps in correct order. The cmdlet expects the path "C:\DeployablePackages" to be the extracted directory from a package
Invoke-D365SDPInstall -Path C:\DeployablePackages -DevInstall
This will execute the "devinstall" mode. The cmdlet expects the path "C:\DeployablePackages" to be the extracted directory from a package
Invoke-D365SDPInstall -Path C:\DeployablePackages -QuickInstall
This will execute the "QuickInstall" mode. The cmdlet expects the path "C:\DeployablePackages" to be the extracted directory from a package
Invoke-D365SCDPBundleInstall -Path "c:\temp\HotfixPackageBundle.axscdppkg"
This will execute the "install" mode without tfs / vsts parameters.
Enable-D365MaintenanceMode
This will put the environment into maintenance mode / state. Normally used when changing license configuration.
Disable-D365MaintenanceMode
This will put the environment back into operation mode / state. Normally used when changing license configuration. Note: You might need to stop and start your entire environment when done.
Get-D365InstalledService
This will get all the installed services based on the installation logs. Note: The cmdlet mimics the AxUpdateInstaller.exe -list command that also only reads the logs files
New-D365TopologyFile -Path C:\Temp\DefaultTopologyData.xml -Services "ALMService","AOSService","BIService" -NewPath C:\temp\CurrentTopology.xml
This will read the "DefaultTopologyData.xml" file and update it with ALMService, AOSService and BIService
$Services = @(Get-D365InstalledService | ForEach-Object {$_.Servicename})
New-D365TopologyFile -Path C:\Temp\DefaultTopologyData.xml -Services $Services -NewPath C:\temp\CurrentTopology.xml
This will read the "DefaultTopologyData.xml" file and update it with the list of services from Get-D365InstalledService output
Get-D365InstalledHotfix
This will get all installed hotfixes on the machine and display all relevant information
Get-D365InstalledHotfix -Model "*retail*"
This will get all installed hotfixes that relates to models with retail in their name on the machine and display all relevant information
Get-D365InstalledHotfix -Model "*retail*" -KB "*43*"
This will get all installed hotfixes that relates to models with retail in their name and where the KB number must contain "43" on the machine and display all relevant information
Invoke-D365ModelUtil -Path c:\temp\ApplicationSuiteModernDesigns_App73.axmodel
This will import the "c:\temp\ApplicationSuiteModernDesigns_App73.axmodel" into the environment.
Note: Please note that you have to compile the application and run a db sync afterwards.
Initialize-D365Config
This will create the default configuration objects and set them to default values
Add-D365EnvironmentConfig -Name "UAT" -URL "https://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp=USMF" -Company "USMF"
This will add en entry named "UAT" with the URL and Company parameters.
Notes: This is the minimum you need to enabled a personal workstation to utilize Invoke-D365TableBrowser or Invoke-D365SysRunnerClass
Set-D365ActiveEnvironmentConfig -Name "UAT"
This will get the environment details that is named UAT and put that into the active environment configuration.
Notes: You MUST restart the powershell session before using any cmdlets that depend on the configuration change.
Set-D365WorkstationMode -Enabled $true
This will configure the module to be capable of running some of the cmdlets from a personal workstation tha is not an D365 environment
Notes: You MUST restart the powershell session before using any cmdlets that depend on the configuration change.
Get-D365EnvironmentConfig
This will show all stored environment configurations
Get-D365ActiveEnvironmentConfig
This will the entire hashtable containing all the environment details
(Get-D365ActiveEnvironmentConfig).SqlPwd
This will only return the SqlPwd value from the active configuration
Notes: On a Tier 2 MS hosted environment we actually load the SqlUser and SqlPassword into memory. So when calling cmdlets that require SqlUser and SqlPassword it is already filled out.
Add-D365AzureStorageConfig -Name "UAT-Exports" -AccountId "1234" -AccessToken "dafdfasdfasdf" -Blob "testblob"
This will add en entry named "UAT-Exports" with the AccountId 1234, AccessToken dafdfasdfasdf and Blob testblob parameters.
Set-D365ActiveAzureStorageConfig -Name "UAT-Exports"
This will get the environment details that is named UAT-Exports and put that into the active Azure Storage Account configuration.
Notes: You MUST restart the powershell session before using any cmdlets that depend on the configuration change.
Get-D365AzureStorageConfig
This will show all stored Azure Storage Account configurations
Get-D365ActiveAzureStorageConfig
This will the entire hashtable containing all the Azure Storage Account details
Get-D365AOTObject -ObjectType AxClass -Path "C:\AOSService\PackagesLocalDirectory\ApplicationFoundation"
This will search for all AxClasses in the ApplicationFoundation package
Get-D365AOTObject -Name "*flush*" -ObjectType AxClass -Path "C:\AOSService\PackagesLocalDirectory\ApplicationFoundation"
This will search for all AxClasses in the ApplicationFoundation package that matches the search "*flush*"
- Install as a non-Administrator
- Install as a Administrator
- Import d365fo.tools module
- List available commands from d365fo.tools module
- Get help content for a command
- Start, Stop and List services
- Import users into the D365FO environment
- Import external users into the D365FO environment
- Enable users in the D365FO environment
- Update users in the D365FO environment
- Provision D365FO environment to new Azure AD tenant
- Import a bacpac file into a Tier1 environment
- List modules / models
- Compile module
- Install AzCopy
- Install SqlPackage
- Install Nuget
- Speed up LCS download via AzCopy
- Download latest bacpac from LCS via AzCopy
- Register NuGet source
- Configure Azure Logic App
- Fix AzureStorageConfig
- Run a runnable class
- Update users in environment
- Work with Azure Storage Account
- Work with packages, resource label files, language and lables
- Working with the different D365 services