PowerShell script to modify Azure data factory trigger time - triggers

I am wondering if there is any PowerShell script which can help to modify the timestamp of the existing ADF trigger. I want to change the time of my pipeline trigger in UAT as we don't have permission to do that manually from portal.

Set-AzDataFactoryV2Trigger
[-Name] <String>
[-DefinitionFile] <String>
[-ResourceGroupName] <String>
[-DataFactoryName] <String>
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
The Set-AzDataFactoryV2Trigger cmdlet creates a trigger in a data factory. If you specify a name for a trigger that already exists, the cmdlet prompts for confirmation before replacing the trigger. If you specify the Force parameter, the cmdlet replaces the existing trigger without prompting for confirmation. Triggers are created in the 'Stopped' state, meaning that they don't immediately begin invoking pipelines that they reference.
Refer this official documentation for sample example and syntax.

Related

Filewatcher to detect only files that are fully uploaded and are ready to copy

I would like to use Powershell filewatcher to monitor an azure file share to lock a file that is currently uploading until it has completed uploading. I have another function that copies the uploaded files to other file shares and I don't want the copy file function to copy a file before it has been completely uploaded successfully. Is this even possible. Someone suggested acquiring a lease file. Does anyone have an example of how to do this in Powershell.
You could use Get-AzStorageFileHandle
Get-AzStorageFileHandle
[-ShareName] <String>
[[-Path] <String>]
[-Recursive]
[-Context <IStorageContext>]
[-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>]
[-DefaultProfile <IAzureContextContainer>]
[-ConcurrentTaskCount <Int32>]
[-IncludeTotalCount]
[-Skip <UInt64>]
[-First <UInt64>]
[<CommonParameters>]
Sample Snippet :
$storagecontext = New-AzStorageContext -StorageAccountName "<STORAGEACCOUNT NAME>" -StorageAccountKey "<KEY>"
Get-AzStorageFileHandle "<FILESHARENAME>" -Context $storagecontext -Recursive
Sample Output :
When I ran the command i was copying the search.py command
If you see a specific directory, coming up in the above commandlet you could safely assume that there is a operation happening in the directory and you could skip the directory from copying.

Is property or field 'ServerRelativeUrl' part of the command Get-PnPFolderItem

I am getting the following error while using the command "Get-PnPFolderItem"
Get-PnPFolderItem : The property or field 'ServerRelativeUrl' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
I checked the documentation and there is no reference of it
Get-PnPFolderItem
[-FolderSiteRelativeUrl <String>]
[-ItemType <String>]
[-ItemName <String>]
[-Web <WebPipeBind>]
[-Connection <SPOnlineConnection>]
Per my test, the command "Get-PnPFolderItem" works fine on my environment. So, yes it should be part of the command Get-PnPFolderItem.
Please maek sure the version of your SharePointPnPPowerShellOnline is the lastest. Also try to connect another site and check if it works.

Azure Powershell script to swap Azure App Service (website) deployment slots

I'm looking for a way to use Azure PowerShell commands to do a deployment swap for an Azure App Service (previously Azure Websites). All of the posts I've seen say to use the command
Move-Deployment -ServiceName
but that appears to only be valid for cloud services and swapping between Production and Staging predefined slots.
I have a website with deployment slots that I've defined and I can use the following command to get information about the website site, but I don't see how to swap it:
Get-AzureWebsite -Name "sitenamehere" -Slot test
Could this be what you're looking for?
Switch-AzureWebsiteSlot [[-Name] <String> ] [[-Slot1] <String> ] [[-Slot2] <String> ] [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]
The solution is to use the command
Switch-AzureWebsiteSlot -Name "sitenamehere"
More details are provided in this blog post http://blogs.msdn.com/b/harikharan/archive/2015/01/01/swap-slots-in-azure-web-site-when-there-are-2-or-more-staging-slots-using-azure-powershell.aspx

How to perform deployment swap on an Azure WebSite using Powershell?

This question refers to the application slots feature for Azure Server Manager (ASM) WebSites that enables the ability to create a staging website under an existing one. I'd like to swap my site's staging and production environments using Powershell, but I haven't found the way to do it with the currently available commands. Does anyone have an idea how to do it?
Switch-AzureWebsiteSlot -Name "your web site name" -Force
You can use this PowerShell cmdlet:
Switch-AzureWebsiteSlot [[-Name] ] [[-Slot1] ] [[-Slot2] ] [-Force] [-Confirm] [-WhatIf] [ ]
[-Force] parameter is used in order to not confirm the swap operation and directly execute
An Example:
C:\PS>Switch-AzureWebsiteSlot -Name YourWebsite

Powershell Help system usage

I am learning powershell, so first i am learning how to use the help system of powershell. Below is the help for command "Get-EventLog",
what do we mean by : Position? named
Also is there any links to get more on how to use the help system
provided by powershell?
Synopsis
Gets the events in an event log, or a list of the event logs, on the local or remote computers.
Syntax Get-EventLog [-LogName] <String> [[-InstanceId] <Int64[]>] [-After <DateTime>] [-AsBaseObject <SwitchParameter>] [-Before <DateTime>] [-ComputerName <String[]>] [-EntryType <String[]>] [-Index <Int32[]>] [-Message <String>] [-Newest <Int32>] [-Source <String[]>] [-UserName <String[]>] [<CommonParameters>]
Get-EventLog [-AsString <SwitchParameter>] [-ComputerName <String[]>] [-List <SwitchParameter>] [<CommonParameters>]
Parameters
-After <DateTime>
Gets only the events that occur after the specified date and time. Enter a DateTime object, such as the one returned by the Get-Date cmdlet.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-InstanceId <Int64[]>
Gets only events with the specified instance IDs.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LogName <String>
Specifies the event log. Enter the log name (the value of the Log property; not the LogDisplayName) of one event log. Wildcard characters are not permitted. This parameter is required.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
For #1, you need to understand how positional parameters are used in PowerShell. You can refer to the following scripting guys article on that.
http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/22/the-problem-with-powershell-positional-parameters.aspx
For #2, in PowerShell v3, there is update-able help. By default, on PowerShell 3.0 systems, there is no help installed. Everything is online. You can download the help content using Update-Help and Save-Help cmdlets.
Also, Get-Help <cmdletname> -Online shows the online (most up-to-date) content for any cmdlet.
You can use the about topics in PowerShell to learn the concepts. These about topics can be accessed using help about*. You will see a huge list of topics which can be accessed using help or Get-Help. For example,
help about_Parameters
Once again, if you are using PowerShell 3.0, you need to update the help first to be able to see any help content.
You can first have a look to about_Command_Syntax
get_help about_Command_Syntax
Then have a look at a few other abouts, if you want to add your own help to your Cmd-Lets have a look here.