Azure VM copy loop (VM naming convention_ - azure

"name": "[concat(parameters('vm-name'),'-0', copyIndex(1))]",
Hello, I am trying to loop around 20 vm's. Vm names should end with 01,02,03...10,11,12..20.
I am getting 010,011,012...obviously with hardcoded '-0' in the name. Is there any other easy way to get 10,11,12..20?
This may be a simple fix, help is appreciated.

Related

Copy files from AWS s3 sub folder to Azure Blob

I am trying to copy files out of a s3 bucket using azure data factory. Firstly I want a list of the directories.
Using the CLI I would use. {aws s3 ls }
From there I can determine from the list in a foreach an push that into a variable.
In adf, I have tried to use 'get metadata', although this works in theory. In practice there are 76 files in each directory and the loop is over 1.5m. This just isn't worth it, it takes far too long, especially as the directories only takes about 20 seconds for 20000 directories.
Is there a method to do this list. When creating the dataset we have a no permissions, however when we use specific location it does.
Many thanks
I have found another way of completing this task.
So to begin with I am using get metadata with the child option. It produces an array.
I push this into a string variable. With this variable you can then create a stored procedure to pick this apart, using openjson to get just the value. This can then be pulled apart further to get the directory names.
I then merge these into a table.
Using lookup I can then run another stored procedure to return the value I require from the table. This whole process runs in a couple of minutes.
Anyone who wants a further explanation, please ask, I will try and create a walk through to assist

Creating a windows shortcut (.lnk) in Linux with spaces in the argument to a network share

I am needing to use Puppet to create windows shortcuts on hosts to be accessed via SAMBA. The Puppet side I'll be fine with, it's the script I've been having issues getting working.
I've tried to use:
mslink_v1.3.sh (http://www.mamachine.org/mslink/index.en.html)
pylnk3.py (https://pypi.org/project/pylnk3)
lnk.py (https://github.com/blacklanternsecurity/mklnk)
mslink_v3.sh on first look covers it all, with the exception of what I need to do. Similar with pylnk3.sh and lnk.sh working together, just a different reason for it not to work.
I am trying to create a windows shortcut to a network location with a argument with a space in it. Example below:
Path to exe = \\myhostname\program.exe
Argument = \\myhostname\program.ini loadabc
mslink_v3.sh will not let me surround the argument in single or double quotes, but works fine for network locations. pylnk3.sh/lnk.sh will not work for network locations, argument with spaces are ok via quotes. I did find in the end a code reference in pylink3.sh that network locations have not been implemented yet.
I've not found away to contact the developer of mslink_v3.sh to see about a tweak. I was going to comment on his post on this site, but I did not have enough points (hoping this post may give me enough).
Any suggestions at this point would be good.
Thanks
Matt
I contacted the developer of pylnk3.py via GitHub. He's added network support and also added all the cli support that lnk.py added.
Link below to the branch with all the development included:
https://github.com/strayge/pylnk/tree/cli_options

Azure New VM in Powershell -AvailabitySetname

Good morning Team.
Need some guidance on New-AZVM ----- --AvailabilitySetName .
ALL the normal params work just fine, but to use AZ load Balancer, you need a Scale set or -Availability Set for VMs.
Normal Centos VM build works 100% without -AvailabilitySetName
When I Get-AzAvailabilitySet I can see my pre-staged Set listed.
When I pass the Get-AzAvailabilitySetName as given by Get-AzAvailabilitySet I get Parameter cannot be resolved.
Does anybody have a working example, Tech-net only states it must be passed as a string .
I validated my Variable with GM and it is. What am I missing?
Found my own answer after two days of playing around, for those who might have a similar problem, it appears the new-azvm -availabiltysetname does not work. You need to define the AzSET with .id where you declare the other VM basics like size with -availabiltysetID parameter, like this > #Define the parameters for the new virtual machine.
$VirtualMachine = New-AzVMConfig -VMName $azureVmName -VMSize $azureVmSize -AvailabilitySetId $azureAvailSetID
Oh like all the others, it needs to be a string

SSIS package works from SSMS but not from agent job

I've an SSIS package to load excel file from network drive. It's designed to load content and then move the file to archived folder.
Everything works good when the following SQL statement runs in SSMS window.
However when it's copied to SQL agent job and executes from there, the file is neither loaded nor moved. But it shows "successful" from the agent log.
The same thing also happened to "SSIS job" instead of T-SQL job, even with proxy of windows account.(same account as ssms login)
Declare #execution_id bigint
EXEC [SSISDB].[catalog].[create_execution] #package_name=N'SG_Excel.dtsx', #execution_id=#execution_id OUTPUT, #folder_name=N'ETL', #project_name=N'Report', #use32bitruntime=True, #reference_id=Null
Select #execution_id
DECLARE #var0 smallint = 1
EXEC [SSISDB].[catalog].[set_execution_parameter_value] #execution_id, #object_type=50, #parameter_name=N'LOGGING_LEVEL', #parameter_value=#var0
EXEC [SSISDB].[catalog].[start_execution] #execution_id
GO
P.S. At first relative path of network drive is applied, then switched to absolute path(\\server\folder). It's not solving the issue.
SSIS Package Jobs run under the context of the SQL Server Agent. What Account is setup to run the SQL Server Agent on the SQL Server? It may need to be run as a Domain account that has access to the network share.
Or you can copy the Excel file to local folder on the SQL Server, so the Package can access the file there.
Personally I avoid the File System Task - I have found it unreliable. I would replace that with a Script Task, and use .NET methods from the System.IO namespace e.g. File.Move. These are way more reliable and have mature error handling.
Here's a starting point for the System.IO namespace:
https://msdn.microsoft.com/en-us/library/ms404278.aspx
Be sure to select the relevant .NET version using the Other Versions link.
When I have seen things like this in the past it's been that my package isn't accessing the path I thought it was at run time, its looking somewhere else, finding an empty folder & exiting with success.
SSIS can have a nasty habit of going back to variable defaults . It may be looking at a different path you used in dev? Maybe hard code all path values as a test? or put in break points & double check the run time values of all variables & parameters.
Other long shots may be:
Name resolution, are you sure the network name is resolving correctly at runtime?
32/64 bit issues. Dev tends to run 32 bit, live may be 64 bit. May interfere with file paths? Maybe force to 32 bit at run time?
There is issue with sql statement not having statement terminator (;) that is causing issue.
Declare #execution_id bigint ;
EXEC [SSISDB].[catalog].[create_execution] #package_name=N'SG_Excel.dtsx', #execution_id=#execution_id OUTPUT, #folder_name=N'ETL', #project_name=N'Report', #use32bitruntime=True, #reference_id=Null ;
Select #execution_id ;
DECLARE #var0 smallint = 1 ;
EXEC [SSISDB].[catalog].[set_execution_parameter_value] #execution_id, #object_type=50, #parameter_name=N'LOGGING_LEVEL', #parameter_value=#var0 ;
EXEC [SSISDB].[catalog].[start_execution] #execution_id ;
GO
I have faced similar issue in service broker ..

Cannot acquire connection to Excel

I have a package with a ForEach Loop Container that is looping through Excel files in directory. Everything is fine until I add #User::Excel to the expressions box in the ExcelFile Path connection manager properties. Then I always get this error:
...DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER......failed with error code 0xC02020096...
I have been dealing with this all day yesterday and this error is killing my deadline. I have everything setup just like any other package I have run with ForLoop and Excel. Why is this time giving me so many problems?
May someone please guide me through some troubleshooting? I have tried everything I know.
Apparantly the package didn't like my ForEach Loop container in a Sequence Container...took the loop out of the Sequence Container, reconfigured, put back in the Sequence Container and worked fine.

Resources